在2.2停使用GridLayout
在2.2下使用GridLayout
并不是在项目下面加入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>