I have a problem with grid view layout on Android. I can\'t find solution to eliminate extra space in grid view. I tried a lot of things (numColumns, columnWidth, stretchMod
To solve my problem I used this gridView:
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/MyGrid" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="0dp"
android:verticalSpacing="2dp"
android:horizontalSpacing="2dp"
android:scrollingCache="true"
android:smoothScrollbar="true"
android:clipChildren="true"
android:alwaysDrawnWithCache="true"
android:numColumns="auto_fit"
android:columnWidth="100dp"
android:stretchMode="columnWidth"
android:gravity="center_horizontal"
android:background="#000000">
</GridView>
The most important thing is the clipChildren
property.