如何在表格布局S $ P $垫列均匀最大限度地利用可用空间 [英] how to make columns in table layout spread evenly making maximum use of space available
本文介绍了如何在表格布局S $ P $垫列均匀最大限度地利用可用空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想用表格布局显示一些数据.... 该数据是3列数据,我想,该列应利用整个宽度可用。但似乎布局XML code,我曾使用是根据内容刚刚结束了列。
布局XML code
< XML版本=1.0编码=UTF-8&GT?;
< TableLayout
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
>
<的TableRow
机器人:layout_width =FILL_PARENT>
<的TextView
机器人:填充=3dip
机器人:重力=左
机器人:文本=名称
/>
<的TextView
机器人:填充=3dip
机器人:重力=左
机器人:文本=地址
/>
<的TextView
机器人:填充=3dip
机器人:重力=左
机器人:文本=时代
/>
< /的TableRow>
< / TableLayout>
解决方案
您可以尝试添加安卓stretchColumns =0,1,2
您< TableLayout>
元素
I was just trying out with table layout to display some data.... The data is a 3 column data and i want that the columns should utilize the whole width available. But it seems that the layout XML code which i had used is just wrapping up the columns according to the content.
Layout XML code
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableRow
android:layout_width="fill_parent">
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Name"
/>
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Address"
/>
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Age"
/>
</TableRow>
</TableLayout>
解决方案
You can try adding android:stretchColumns="0,1,2"
to your <TableLayout>
element.
这篇关于如何在表格布局S $ P $垫列均匀最大限度地利用可用空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文