2013-03-29 17:01 4390人閱讀 評論(0) 收藏 舉報 [html] view plain copy
- <GridView android:id="@+id/grid"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:verticalSpacing="35px" <!-- grid元素之間的豎直間隔 -->
- android:horizontalSpacing="5px" <!--grid元素之間的水準間隔 -->
- android:numColumns="auto_fit" <!--表示有多少列,如果設定為auto_fit,将根據columnWidth和Spacing來自動計算 -->
- android:columnWidth="100px" <!-- 一般建議采用有像素密度無關的dip或者dp來表示-->
- android:stretchMode="columnWidth" <!--如何填滿空餘的位置,模拟器采用WVGA800*480,每排4列,有4*100+5*3=415,還餘65px的空間,如果是columnWidth,則這剩餘的65将分攤給4列,每列增加16/17px。如果采用SpacingWidth,則分攤給3個間隔空隙 -->
- android:gravity="center" />