GridView and excess space padding

后端 未结 1 988
难免孤独
难免孤独 2020-12-03 11:56

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

相关标签:
1条回答
  • 2020-12-03 12:40

    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.

    0 讨论(0)
提交回复
热议问题