TableLayout经常用的属性是:

 

android:collapseColumns:以第0行为序,隐藏指定的列:

android:collapseColumns该属性为空时,如下图:

android - TableLayout之android:collapseColumns ,android:shrinkColumns 和stretchColumns

把android:collapseColumns=0,2--------------》意思是把第0和第2列去掉,如下图:

android - TableLayout之android:collapseColumns ,android:shrinkColumns 和stretchColumns

 

android:shrinkColumns:以第0行为序,自动延伸指定的列填充可用部分:

当LayoutRow里面的控件还没有布满布局时,shrinkColumns不起作用,如下图:

android - TableLayout之android:collapseColumns ,android:shrinkColumns 和stretchColumns

设置了shrinkColumns=0,1,2,布局完全没有改变,因为LayoutRow里面还剩足够的空间。

当LayoutRow布满控件时,如下图:

android - TableLayout之android:collapseColumns ,android:shrinkColumns 和stretchColumns

设置设置了shrinkColumns=2,则结果如下图,控件自动向垂直方向填充空间:

android - TableLayout之android:collapseColumns ,android:shrinkColumns 和stretchColumns

 

 

android:stretchColumns:以第0行为序,尽量把指定的列填充空白部分:

android - TableLayout之android:collapseColumns ,android:shrinkColumns 和stretchColumns

设置stretchColumns=1,则结果如下图,第1列被尽量填充(Button02与TextView02同时向右填充,直到TextView03被压挤到最后边)。

android - TableLayout之android:collapseColumns ,android:shrinkColumns 和stretchColumns

相关文章:

  • 2022-12-23
  • 2021-08-22
  • 2021-12-17
  • 2021-06-26
  • 2022-12-23
  • 2021-07-01
  • 2021-12-28
  • 2022-12-23
猜你喜欢
  • 2021-08-08
  • 2021-12-02
  • 2021-10-28
  • 2021-06-22
相关资源
相似解决方案