如何使用Android GridView设置相等的间距?

Joh*_*nny 7 android android-layout android-gridview

如何设置剩余的空间被平分?

例如,我有一个包含2列的GridView.全宽为700px,列为200px:如何指定xml,左边的空间(300px)被均分为3个?

即100px | 200px(第1列)| 100px | 200px(第2列)| 100px的

Les*_*leh 13

设置android:stretchMode为spacingWidthUniform.

http://developer.android.com/reference/android/widget/GridView.html#attr_android:stretchMode

  • 可能看起来很明显(这不是我),但你需要删除任何`android:horizo​​ntalSpacing`否则它将无法正常工作 (4认同)