一:<TableRow>运用
包含的内容为同一行元素
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TableRow>
<Button
android:text="第一个"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:text="第二个"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<Button
android:text="第一个"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:text="第二个"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableLayout>
结果:
按钮有超出部分按钮直接不显示
二:常见属性

Android:collapseColumns:隐藏
android:collapseColumns="0,1"//隐藏多行加逗号
结果:

Android:stretchColums:设置被拉伸的的列的序号(从零开始)要有空余的部分
Android:shrinkColumns:设置被收缩的列的序号(从零开始)要有超出的部分
子控件设置属性
Android:layout_column:指定某一行的在第几个部分显示
、
后面的设置数不可小于等于前者,否则失效。
Android:layout_span:跨几列

浙公网安备 33010602011771号