BACKGROUND: My working app contains a GridView with 5 rows of 11 columns with an overridden adapter for display. It works great for my needs with a large displ
My solution was to create a layout recalculation routine, changing the # of columns and their sizes
There may be a better way, but with no replies, this is a quick and dirty hack that worked
public void gvlpRecalc() {
m_gv.setNumColumns(m_Columns);
if ((btnWidth = (int) (m_gv.getWidth() / m_Columns + .5)) == 0) {
Display display = ((Activity) m_Context).getWindowManager().getDefaultDisplay();
btnWidth = (int) (display.getWidth() / m_Columns + .5);
switch (m_Columns) {
case 8:
btnHeight = (int) (btnWidth * .9);
break;
case 10:
btnHeight = (int) (btnWidth * 1.2);
break;
default:
btnHeight = btnWidth;
}
} else
switch (m_Columns) {
case 8:
btnHeight = (int) (btnWidth * .9);
break;
case 10:
btnHeight = (int) (btnWidth * 1.2);
break;
case 11:
btnHeight = btnWidth;
break;
default:
btnHeight = (int) (m_gv.getHeight() / 2.2);
}
gvlp = new GridView.LayoutParams(btnWidth, btnHeight);
}