zoukankan      html  css  js  c++  java
  • Android GridView(九宫图)

     GridView跟ListView都是比较常用的多控件布局,而GridView更是实现九宫图的首选!

    <?xml version="1.0" encoding="utf-8"?>  
    <GridView xmlns:android="http://schemas.android.com/apk/res/android"   
        android:id="@+id/gridview"  
        android:layout_width="fill_parent"   
        android:layout_height="fill_parent"  
        android:numColumns="auto_fit"  
        android:verticalSpacing="10dp"  
        android:horizontalSpacing="10dp"  
        android:columnWidth="90dp"  
        android:stretchMode="columnWidth"  
        android:gravity="center"  
    />  
    <GridView
            android:id="@+id/xxx"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#EEEEEE"
            android:gravity="center"
            android:horizontalSpacing="15dp"
            android:numColumns="2"
            android:padding="15dp"
            android:stretchMode="columnWidth"
            android:verticalSpacing="10dp" >
        </GridView>

    介绍一下里面的某些属性:

    android:numColumns="auto_fit" ,GridView的列数设置为自动

    android:columnWidth="90dp",每列的宽度,也就是Item的宽度
    android:stretchMode="columnWidth",缩放与列宽大小同步
    android:verticalSpacing="10dp",两行之间的边距,如:行一(NO.0~NO.2)与行二(NO.3~NO.5)间距为10dp
    android:horizontalSpacing="10dp",两列之间的边距。

    stareblankly.cn
  • 相关阅读:
    SCU 3133(博弈)
    SCU 3132(博弈)
    hdu 5183(hash)
    hdu3329(2次dfs)
    hdu5179(数位dp)
    zoj2314(有上下界的网络流)
    CF 519E(树上倍增求lca)
    hdu1251(Trie树)
    SCU 2009(数位dp)
    【Leetcode】Letter Combinations of a Phone Number
  • 原文地址:https://www.cnblogs.com/stareblankly/p/4920703.html
Copyright © 2011-2022 走看看