Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set equal spacing with Android GridView?

How to set the space left over to be divided equally?

For example, I have a GridView with 2 columns. The full width is 700px, and the column is 200px: how do I specify the xml, so the space left (300px) are divided evenly into 3 pieces?

i.e. 100px | 200px (Column 1) | 100px | 200px (Column 2) | 100px

like image 781
Johnny Avatar asked Oct 22 '13 23:10

Johnny


1 Answers

Set the android:stretchMode to spacingWidthUniform.

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

like image 173
Lesleh Avatar answered Sep 19 '22 16:09

Lesleh