【问题标题】:How to force TableRow have same height如何强制 TableRow 具有相同的高度
【发布时间】:2013-12-11 17:14:46
【问题描述】:

我有同样的问题,因为这些主题:Fixed height of tableRow AndroidHow to force TableRows to have the same height? 但是我还没有找到答案((( TableRow whis layout_width="match_parent", layout_height="0dp", android:layout_weight="1" 并且每个 TableRow 包含几个 GridView。当 GridView 为空时,所有 TableRow 具有相同的高度,但如果添加项目,则第一行变得更高。 我的 XML:

<TableLayout
    android:id="@+id/table"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="@dimen/activity_padding"
    android:clipChildren="false"
    android:weightSum="2" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >

        <GridView
            android:id="@+id/gridView1"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:numColumns="3" >
        </GridView>

        <GridView
            android:id="@+id/gridView2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:numColumns="3" >
        </GridView>
    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >

        <GridView
            android:id="@+id/gridView4"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:numColumns="3" >
        </GridView>

        <GridView
            android:id="@+id/gridView5"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:numColumns="3" >
        </GridView>
    </TableRow>
</TableLayout>

谢谢!!!

【问题讨论】:

    标签: android android-tablelayout


    【解决方案1】:

    为表格行设置填充..您可以像其他行一样调整高度..

    【讨论】:

      猜你喜欢
      • 2013-02-14
      • 1970-01-01
      • 1970-01-01
      • 2018-09-09
      • 2020-02-14
      • 2023-03-09
      • 1970-01-01
      • 2021-08-31
      • 1970-01-01
      相关资源
      最近更新 更多