3.8学习总结
今天学习了布局5GridLayout
<?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:columnCount="3" 设置行的显示个数
android:rowCount="4" 设置列的显示个数
android:orientation="horizontal" 设置水平显示还是垂直显示
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="first">
</Button>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_row="1" 显示在第几行
android:layout_rowSpan="1" 横向跨几行
android:layout_column="0" 显示在第几列
android:layout_columnWeight="1" 横向剩余空间分配方式
android:layout_rowWeight="1" 纵向剩余空间分配方式
android:text="second">
</Button>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnSpan="3" 横向跨几列
android:layout_gravity="fill" 在网格中的显示位置
android:text="third">
</Button>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="first">
</Button>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="second">
</Button>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="third">
</Button>
</GridLayout>

浙公网安备 33010602011771号