我想要实现的是一个简单的 3 列 11 行表。现在所有数据都显示在 1 列和 33 行中。这是输出:
Rank
Percentage
Score
1
1234
13453
2
2352435
312413
3
235325
235423
//etc...
我已经搞砸了许多 TableLayouts 的在线示例,但我的所有输出对于所有示例都保持不变。我下面的只是我尝试的最后一个。有什么建议么?
高分main.xml
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:fillViewport="true" >"
<TableLayout
android:id="@+id/tableLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1" >
<TableRow
android:id="@+id/rowHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/rank"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/percentage"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/score"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TableRow
android:id="@+id/row1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/r1r"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/r1p"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/r1s"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TableRow
android:id="@+id/row2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/r2r"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/r2p"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/r2s"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
//TableRows 1 through 10 are identical.
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="MAIN MENU"
android:id="@+id/homeBtn" />
</TableLayout>
</ScrollView>