在2.2下使用GridLayout

from:http://zheyiw.iteye.com/blog/1926973
并不是在项目下面加入android-support-v7-gridlayout.jar
正确的使用方法如下:


1 在SDK目录下的  \extras\android\support\v7下有 gridlayout 项目,是个library项目, 导入eclipse 稍微调试一下,就不报错了(附件就是)
2  在自己的项目上右键-->属性-->android-->library里面添加上面的项目
3  按照下面的demo使用就可以啦


<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res/com.example.androidtest"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:alignmentMode="alignBounds"
    app:columnCount="3"
    app:columnOrderPreserved="false"
    app:rowCount="5"
    app:useDefaultMargins="true" >


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        app:layout_rowSpan="2"
        android:text="@string/hello_world" />


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        app:layout_rowSpan="1"
        android:text="@string/hello_world" />


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        app:layout_rowSpan="3"
        android:text="@string/hello_world" />


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        app:layout_rowSpan="1"
        android:text="@string/hello_world" />


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        app:layout_rowSpan="1"
        android:text="@string/hello_world" />


</android.support.v7.widget.GridLayout>





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值