问题
Here is my GridView. I have 3 items in each row.
As shown in the picture, the last row in the view contains only one item. If the last row contains 3 items, the grid view scrolls properly till the end. If the last row has less than 3 items the view doesn't scroll more than what is shown in the picture. GridView ignores the row which is not filled completely. What could be the reason for this?
Note: It works fine if I add invisible dummy items at the end to fill the row.
This is my GridView layout.
<GridView
android:id="@+id/grid_view_featuredtab"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:columnWidth="190dp"
android:drawSelectorOnTop="true"
android:horizontalSpacing="3dp"
android:listSelector="@color/gridviewlistselector"
android:numColumns="auto_fit"
android:paddingRight="4dp"
android:stretchMode="spacingWidthUniform"
android:verticalSpacing="3dp" >
回答1:
As of now, tackled it by adding dummy hidden row of items at the end.
来源:https://stackoverflow.com/questions/14286009/layout-issue-with-the-last-row-of-gridview-in-android