collapseColumns  设置需要被隐藏的列序号(序号从0开始)

shrinkColumns     设置允许被首夺的列的序号(序号从0开始)

stretchColumns    设置允许被拉伸的列的序号(序号从0开始)

原先没设置时候的样子

设置后的效果:

  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. android:id="@+id/root_relativeLayout_id"
  3. xmlns:tools="http://schemas.android.com/tools"
  4. android:layout_width="match_parent"
  5. android:layout_height="match_parent"
  6. android:orientation="vertical">
  7.  
  8. <TextView
  9. android:layout_width="wrap_content"
  10. android:layout_height="wrap_content"
  11. android:text="第一个tabelLayout"
  12. android:textAppearance="?android:attr/textAppearanceLarge" />
  13.  
  14. <!-- 第二列允许收缩,第三列允许拉伸 -->
  15. <TableLayout
  16. android:layout_width="match_parent"
  17. android:layout_height="wrap_content"
  18. <strong><span style="color:#ff0000;">android:shrinkColumns="1" //收缩
  19. android:stretchColumns="2">//拉伸</span></strong>
  20.  
  21. <Button
  22. android:id="@+id/button1"
  23. android:layout_width="wrap_content"
  24. android:layout_height="wrap_content"
  25. android:text="Button" />
  26.  
  27. <TableRow
  28. android:id="@+id/tableRow1"
  29. android:layout_width="wrap_content"
  30. android:layout_height="wrap_content" >
  31.  
  32. <Button
  33. android:id="@+id/button2"
  34. android:layout_width="wrap_content"
  35. android:layout_height="wrap_content"
  36. android:text="Button" />
  37.  
  38. <Button
  39. android:id="@+id/button3"
  40. android:layout_width="wrap_content"
  41. android:layout_height="wrap_content"
  42. android:text="收缩的第二列,看出效果了么" />
  43.  
  44. <Button
  45. android:id="@+id/button4"
  46. android:layout_width="wrap_content"
  47. android:layout_height="wrap_content"
  48. android:text="Button" />
  49.  
  50. </TableRow>
  51. </TableLayout>
  52.  
  53. <TextView
  54. android:layout_width="wrap_content"
  55. android:layout_height="wrap_content"
  56. android:text="第二个tabelLayout"
  57. android:textAppearance="?android:attr/textAppearanceLarge" />
  58.  
  59. <!-- 第二列隐藏 -->
  60. <TableLayout
  61. android:layout_width="match_parent"
  62. android:layout_height="wrap_content"
  63. <strong><span style="color:#ff0000;">android:collapseColumns="1">//隐藏</span></strong>
  64.  
  65. <Button
  66. android:id="@+id/button5"
  67. android:layout_width="wrap_content"
  68. android:layout_height="wrap_content"
  69. android:text="Button" />
  70.  
  71. <TableRow
  72. android:id="@+id/tableRow2"
  73. android:layout_width="wrap_content"
  74. android:layout_height="wrap_content" >
  75.  
  76. <Button
  77. android:id="@+id/button6"
  78. android:layout_width="wrap_content"
  79. android:layout_height="wrap_content"
  80. android:text="Button" />
  81.  
  82. <Button
  83. android:id="@+id/button7"
  84. android:layout_width="wrap_content"
  85. android:layout_height="wrap_content"
  86. android:text="Button" />
  87.  
  88. <Button
  89. android:id="@+id/button8"
  90. android:layout_width="wrap_content"
  91. android:layout_height="wrap_content"
  92. android:text="Button" />
  93.  
  94. </TableRow>
  95. </TableLayout>
  96.  
  97. <TextView
  98. android:layout_width="wrap_content"
  99. android:layout_height="wrap_content"
  100. android:text="第三个tabelLayout"
  101. android:textAppearance="?android:attr/textAppearanceLarge" />
  102.  
  103. <!-- 第二列和第三列拉伸 -->
  104. <TableLayout
  105. android:layout_width="match_parent"
  106. android:layout_height="wrap_content"
  107. <strong><span style="color:#ff0000;"> android:stretchColumns="1,2">//拉伸</span></strong>
  108.  
  109. <Button
  110. android:id="@+id/button9"
  111. android:layout_width="wrap_content"
  112. android:layout_height="wrap_content"
  113. android:text="Button" />
  114.  
  115. <TableRow
  116. android:id="@+id/tableRow3"
  117. android:layout_width="wrap_content"
  118. android:layout_height="wrap_content" >
  119.  
  120. <Button
  121. android:id="@+id/button10"
  122. android:layout_width="wrap_content"
  123. android:layout_height="wrap_content"
  124. android:text="Button" />
  125.  
  126. <Button
  127. android:id="@+id/button11"
  128. android:layout_width="wrap_content"
  129. android:layout_height="wrap_content"
  130. android:text="Button" />
  131.  
  132. <Button
  133. android:id="@+id/button12"
  134. android:layout_width="wrap_content"
  135. android:layout_height="wrap_content"
  136. android:text="Button" />
  137.  
  138. </TableRow>
  139.  
  140. <TableRow
  141. android:id="@+id/tableRow4"
  142. android:layout_width="wrap_content"
  143. android:layout_height="wrap_content" >
  144.  
  145. <Button
  146. android:id="@+id/button13"
  147. android:layout_width="wrap_content"
  148. android:layout_height="wrap_content"
  149. android:text="Button" />
  150.  
  151. <Button
  152. android:id="@+id/button14"
  153. android:layout_width="wrap_content"
  154. android:layout_height="wrap_content"
  155. android:text="Button" />
  156.  
  157. </TableRow>
  158. </TableLayout>
  159.  
  160. </LinearLayout>

Table中collapseColumns,stretchColumns的更多相关文章

  1. TableLayout中collapseColumns,stretchColumns的介绍

     设置后→  collapseColumns  设置需要被隐藏的列序号(序号从0开始) shrinkColumns     设置允许被首夺的列的序号(序号从0开始) stretchColumns   ...

  2. bootstrap Table 中给某一特定值设置table选中

    bootstrap Table 中给某一特定值设置table选中 需求: 如图所示:左边地图人员选定,右边表格相应选中. 功能代码: //表格和图标联动 function changeTableSel ...

  3. js遍历table中的每一个元素

    function GetInfoFromTable(tableid) { var tableInfo = ""; var tableObj = document.getElemen ...

  4. IOS Table中Cell的重用reuse机制分析

    IOS Table中Cell的重用reuse机制分析 技术交流新QQ群:414971585 创建UITableViewController子类的实例后,IDE生成的代码中有如下段落: - (UITab ...

  5. table中bordercolor属性设置后最新ie浏览器或firefox中不显示边线,借助table的css来实现边线

    table中的bordercolor属性设置后在最新的ie或者firefox中均不显示边线,table的边线又是常用功能.只能使用css来实现了,更通用,更方便一些. css: ​.ctable{ b ...

  6. 如何让table中td宽度固定

    table中td会随着里面的内容伸缩,设置其width样式并没有效果.这个时候需要下面的CSS可以实现. 首先是设置table .table {table-layout:fixed;} 其次是td . ...

  7. ajax将json写到table中去

    查询条件: <table style="width: 100%;border-collapse: collapse;" > <tr> <th styl ...

  8. jquery 在 table 中修改某行值

    修改 table 中某行的的方法步骤如下: 1.选择要修改的行,事件触发,比如我的 双击某行时修改 2.将要修改的行,替换为input,原先的列中的值,需要放到对应的input中作为默认值 3.修改完 ...

  9. 《项目经验》--后台一般处理程序向前台JS文件传递JSON,JS解析JSON,将数据显示在界面--显示在DropDownList 或 显示在动态创建的table中

    http://blog.csdn.net/mazhaojuan/article/details/8599167 先看一下我要实现的功能界面: 这篇文章主要介绍:后台一般处理程序把从数据库查找的数据,转 ...

随机推荐

  1. 图学ES6-4.字符串的扩展

  2. Lambda表达式浅析

    Lambda 表达式是一种可用于创建"委托"或"表达式目录树"类型的"匿名函数".通过使用 lambda 表达式,可以写入可作为参数传递或作 ...

  3. Vue2服务端渲染

    Vue2 服务端渲染 花费了一个月时间,终于在新养车之家项目中成功部署了vue2服务端渲染(SSR),并且使用上了Vuex 负责状态管理,首屏加载时间从之前4G网络下的1000ms,提升到了现在500 ...

  4. chrome如何在选项卡打开网页

    1.鼠标中间点击,会打开新选项卡 2.按住ctrl,然后鼠标点击,也是可以的 3.

  5. svn+apache

    参考文章:http://www.ttlsa.com/svn/apache-svn-configure/ http://blog.csdn.net/huangshaotian/article/detai ...

  6. AngularJS之jeDate日期控件基本使用

    业务背景: 初学AngularJs,最近一段时间,因业务需求,要求日期选择带有快捷键.时分秒等.鉴于AngularJS组件库ui-bootstrap没有此功能,找了一款基于原生JS实现的插件-jeDa ...

  7. HttpServlet Service方法

    service() 方法是执行实际任务的主要方法.Servlet 容器(即 Web 服务器)调用 service() 方法来处理来自客户端(浏览器)的请求,并把格式化的响应写回给客户端. 每次服务器接 ...

  8. FireDAC 下的 Sqlite [8] - 自定义函数

    Sqlite 本身没有这个功能, FireDAC 通过 TFDSQLiteFunction 增加了该功能; 尽管通过某些 SQL 语句或通过视图也可以达到类似效果, 但函数会更灵活些. 本例先建了一个 ...

  9. spring cloud 学习(8) - sleuth & zipkin 调用链跟踪

    业务复杂的微服务架构中,往往服务之间的调用关系比较难梳理,一次http请求中,可能涉及到多个服务的调用(eg: service A -> service B -> service C... ...

  10. HDU 4031 Attack

    Attack Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) Total Sub ...