经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 移动开发 » Android » 查看文章
Android 表格布局 TableLayout
来源:cnblogs  作者:thomas_blog  时间:2019/11/4 8:29:18  对本文有异议

属性介绍

stretchColumns:列被拉伸

shrinkColumns:列被收缩

collapseColumns:列被隐藏

举例测试

  1. <TableLayout
  2. android:id="@+id/table1"
  3. android:layout_width="fill_parent"
  4. android:layout_height="wrap_content"
  5. android:stretchColumns="0" >
  6.  
  7. <TableRow
  8. android:id="@+id/row1"
  9. android:layout_width="fill_parent"
  10. android:layout_height="wrap_content" >
  11.  
  12. <TextView
  13. android:id="@+id/textView"
  14. android:layout_width="wrap_content"
  15. android:layout_height="wrap_content"
  16. android:background="#fd8d8d"
  17. android:text="測試表格布局"
  18. android:textColor="#000000" />
  19. </TableRow>
  20. </TableLayout>
  21.  
  22. <TableLayout
  23. android:id="@+id/table2"
  24. android:layout_width="fill_parent"
  25. android:layout_height="wrap_content"
  26. android:shrinkColumns="0,1,2,3" >
  27.  
  28. <TableRow
  29. android:id="@+id/row2"
  30. android:layout_width="fill_parent"
  31. android:layout_height="wrap_content" >
  32.  
  33. <Button
  34. android:id="@+id/button1"
  35. android:layout_width="wrap_content"
  36. android:layout_height="wrap_content"
  37. android:text="button1" />
  38.  
  39. <Button
  40. android:id="@+id/button2"
  41. android:layout_width="wrap_content"
  42. android:layout_height="wrap_content"
  43. android:text="button2" />
  44.  
  45. <Button
  46. android:id="@+id/button3"
  47. android:layout_width="wrap_content"
  48. android:layout_height="wrap_content"
  49. android:text="button3" />
  50.  
  51. <Button
  52. android:id="@+id/button4"
  53. android:layout_width="wrap_content"
  54. android:layout_height="wrap_content"
  55. android:text="button4" />
  56. </TableRow>
  57. </TableLayout>
  58.  
  59. <TableLayout
  60. android:id="@+id/table3"
  61. android:layout_width="fill_parent"
  62. android:layout_height="wrap_content"
  63. android:stretchColumns="0" >
  64.  
  65. <TableRow
  66. android:id="@+id/row3"
  67. android:layout_width="fill_parent"
  68. android:layout_height="wrap_content" >
  69.  
  70. <EditText
  71. android:id="@+id/editText"
  72. android:layout_width="fill_parent"
  73. android:layout_height="wrap_content"
  74. android:text="查詢" />
  75. </TableRow>
  76. </TableLayout>

image

原文链接:http://www.cnblogs.com/zhangxuechao/p/11787167.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号