码上敲享录 > android开发实例 > android:stretchColumns什么意思

android:stretchColumns什么意思

上一章章节目录下一章 2018-04-05已有2936人阅读 评论(0)

android:stretchColumns什么意思?

解决方法:

android: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      

android:layout_width="match_parent"

       android:layout_height="match_parent"

       android:stretchColumns="*"      

       >

       <TableRow

           android:id="@+id/tableRow1"

           android:layout_width="wrap_content"

           android:layout_height="wrap_content" >

           <Button

               android:id="@+id/button1"

               android:layout_width="wrap_content"

               android:layout_height="wrap_content"

               android:text="Button" />

            <Button

               android:id="@+id/button2"

               android:layout_width="wrap_content"

               android:layout_height="wrap_content"

               android:text="Button" />

       </TableRow>

   </TableLayout>

本文地址:http://www.yayihouse.com/yayishuwu/chapter/1142



向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交