Android 如何强制TableRow具有相同的高度

Android 如何强制TableRow具有相同的高度,android,android-tablelayout,Android,Android Tablelayout,我有同样的问题,因为这些主题:,但我没有找到答案((( TableRow具有layout\u width=“match\u parent”、layout\u height=“0dp”、android:layout\u weight=“1”,并且每个TableRow包含很少的GridView。当GridView为空时,所有TableRow具有相同的高度,但如果添加项目,第一行将变高。 我的XML: 谢谢!!!设置表格行的填充。您可以调整与其他行相同的高度 <TableLayout

我有同样的问题,因为这些主题:,但我没有找到答案((( TableRow具有layout\u width=“match\u parent”、layout\u height=“0dp”、android:layout\u 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>