【发布时间】:2013-12-11 17:14:46
【问题描述】:
我有同样的问题,因为这些主题:Fixed height of tableRow Android,How 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