1. <TableRow>和<TextView>中的layout_width和layout_height都是由tablelayout控制
2. <TextView android:layout_column="1"> layout_column设置为第一列
3. <TextView android:layout_span="2"> layout_span设置跨2列
4. stretchColumns设置拉伸第几列
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1">
<TableRow >
<TextView
android:layout_column="1"
android:text="XX"
android:textSize="32sp"
/>
<TextView
android:gravity="right"
android:text="CTRL+O"
android:textSize="32sp"
/>
</TableRow>
<TableRow >
<TextView
android:text=" "
android:textSize="32sp"
/>
<TextView
android:text="XX"
android:textSize="32sp"
/>
<TextView
android:text="SHIFT+CTRL+O"
android:textSize="32sp"
/>
</TableRow>
<TableRow >
<TextView
android:text="T"
android:textSize="32sp"
/>
<TextView
android:layout_span="2"
android:text="XX"
android:textSize="32sp"
/>
</TableRow>
</TableLayout>
本文详细介绍了如何使用TableLayout在Android中实现表格布局,包括 TableRow、TextView 的使用及属性配置,展示如何通过 layout_width、layout_height、layout_column、layout_span 等属性来控制元素的排列和布局。
170

被折叠的 条评论
为什么被折叠?



