If you set android:numColumns
to auto_fit
, you also need to set android:columnWidth
so that the GridView is able to compute how many items can fit. The GridView will not create any item view before it knows how many of them it can fit in a row, and it will not measure the item views.
You should always be able to determine the width of your items in advance if you're using auto_fit
. If you're not, it means that your items may have a different width and in that case your items will not render properly because columns in a GridView always have the same size.