Android 网格布局
示例
顾名思义,GridLayout是用于在网格中排列View的布局。GridLayout将自身分为列和行。如下面的示例所示,列和/或行的数量由属性columnCount和指定rowCount。将视图添加到此布局会将第一个视图添加到第一列,将第二个视图添加到第二列,并且将第三个视图添加到第二行的第一列。
<?xml version="1.0" encoding="utf-8"?>
<GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:columnCount="2"
android:rowCount="2">
<TextView
android:layout_width="@dimen/fixed"
android:layout_height="wrap_content"
android:text="@string/first"
android:background="@color/colorPrimary"
android:layout_margin="@dimen/default_margin" />
<TextView
android:layout_width="@dimen/fixed"
android:layout_height="wrap_content"
android:text="@string/second"
android:background="@color/colorPrimary"
android:layout_margin="@dimen/default_margin" />
<TextView
android:layout_width="@dimen/fixed"
android:layout_height="wrap_content"
android:text="@string/third"
android:background="@color/colorPrimary"
android:layout_margin="@dimen/default_margin" />
</GridLayout>热门推荐
10 职场祝福语大全 简短精辟
11 老人过大寿祝福语简短
12 生日牌祝福语英语简短
13 生日祝福语大全女孩简短
14 怎么说祝福语简短
15 带清的简短祝福语
16 杨奕老师祝福语简短
17 新婚祝福语大全简短精炼
18 聚餐会祝福语简短