Pan*_*mar 70 android tablelayout
我TableLayout用来显示4列数据列表.
问题描述:
我无法设置所有4列的相等宽度,这是我的TableLayout.我正在使用我正在使用的布局代码...
<TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="0">
<TableRow>
<TextView android:text="table header1" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textSize="10dip" android:textStyle="bold"/>
<TextView android:text="table header2" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textSize="10dip" android:textStyle="bold"/>
<TextView android:text="table header3" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textSize="10dip" android:textStyle="bold"/>
<TextView android:text="table header4" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textSize="10dip" android:textStyle="bold"/>
</TableRow>
</TableLayout>
Run Code Online (Sandbox Code Playgroud)
我应该如何重写此布局以显示相同大小的4列?
She*_*tib 185
它归结为添加android:stretchColumns="*"到你的TableLayoutroot并设置android:layout_width="0dp"你TableRow的所有孩子.
<TableLayout
android:stretchColumns="*" // Optionally use numbered list "0,1,2,3,..."
>
<TableRow
android:layout_width="0dp"
>
Run Code Online (Sandbox Code Playgroud)
iTu*_*rki 69
将android:stretchColumns值更改为*
值0表示拉伸列1.值1表示拉伸列2,依此类推.
值*表示拉伸所有列
| 归档时间: |
|
| 查看次数: |
123072 次 |
| 最近记录: |