【问题标题】:Android:StretchColumns: Correct arguments?Android:StretchColumns:正确的论点?
【发布时间】:2014-05-21 20:02:40
【问题描述】:

对于以下代码:

    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:stretchColumns="2" >

android:stretchColumns="2" 是表示 3 列是可拉伸的,还是表示第 3 列是可拉伸的?

【问题讨论】:

    标签: android tablelayout


    【解决方案1】:

    TableLayout 可以将某些列指定为可收缩或可拉伸 通过调用 setColumnShrinkable() 或 setColumnStretchable()。如果标记为可缩小,则可以缩小列宽以使表格适合其父对象。如果标记为可拉伸,它可以扩展宽度以适应任何额外的空间。表格的总宽度由其父容器定义。

    看看这里,请记住,如果您的表格非常适合父对象(没有剩余空间可拉伸),那么无论您输入什么值,您都不会看到任何变化。

    【讨论】:

    • 这没有回答我的问题?
    【解决方案2】:

    如果你想拉伸所有列,你应该使用 android:stretchColumns="*" 它也适用于 android:shrinkColumns。

    这个专业教程应该解释你所有的问题 http://www.onlinevideolecture.com/computer-programming/slidenerd/android-programming-course-android-tutorials-for-beginners/index.php?course_id=2369&lecture_no=59

    android:stretchColumns="1" 将拉伸第 1 列 android:stretchColumns="0,1" 将拉伸第 1 列和第 0 列。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-15
      • 1970-01-01
      • 1970-01-01
      • 2020-06-16
      • 2012-08-23
      相关资源
      最近更新 更多