Hello fellow developers.
I have a Grid View in an android application. The grid view has the setting to automatically fit the number of columns and has a minimum column width of 250 pixels.
Inside the grid cells, I have a LinearLayout that has an Image View and some Text Views.
I want my Image View to be always square, but unfortunately I was not able to do this with any layout settings (open to suggestions here, if there is an option I missed).
So my idea is that I should somehow get the grid column width in my image Loading class and adjust the imageView height dynamically there, to match the width.
I failed getting the column width though.
If I set a breakPoint in my public View getView(int position, View convertView, ViewGroup parent)
I see that my parent ViewGroup is the Grid and it has the correct value of the column width, but when I use:
GridView mGridView = (GridView)parent;
int width = mGridView.getColumnWidth();
the app crashes as it says there is no getColumnWidth method.
Any help here?