首页 头条 财经 产业 金融 电商 跨境 物流 会展 English
首页 / 网尚家电 / 正文

Stretchcolumns设置子标签的某列是否拉伸占满剩余空间

来源:
编辑:电经淘讯
时间:2023-09-01

 stretchColumns是TableLayout布局标签的一个特有属性,用来设置TableLayout的子标签TableRow的某列是否拉伸占满剩余的空间。例如:TableRow相当html中table的tr标签,TableRow中有两个按钮button(相当两个列td)一行显示,假如此时TableRow的宽度是700px,每个button长度是50px,那么这一行的右边600px是空的,所为了让这行铺满,就得使用android:stretchColumns。


android:stretchColumns="*"代表TableRow中的每一列都平均拉长铺满一行(每个td宽度一样)
android:stretchColumns="0"代表TableRow中的每第一列拉长铺满一行
android:stretchColumns="1"代表TableRow中的每第二列拉长铺满一行
android:stretchColumns="0,1"代表TableRow中的每第一列和第二列平均拉长铺满一行
TableLayout的基本使用方法:
< ?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="h
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableRow>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button1"
android:layout_column="0"/>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a Button2"
android:layout_column="1"/>
</TableRow>
</TableLayout>

电经快报更多
经济视界更多

广交会共话纺织业价值跃升,科技赋能织

11月1日,广交会“走进行业”交流会——科技赋能织就产业新图景...[详细]

丽尚国潮2026年三季报解读: 营收企稳

10月31日,丽尚国潮(600738.SH)披露2026年第三季度报告。数据显...[详细]

热点财经更多
  • CopyRight @ 2013-2026 Reserved CN电商经济网版权所有所涉内容免责声明查阅