请看这里的 XML 代码:
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
xmlns:android="http://schemas.android.com/apk/res/android">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- Some stuff goes here -->
/>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- Some stuff goes here -->
/>
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- Some stuff goes here -->
/>
</TableRow>
</TableLayout>
我的代码比这长得多,但我只是删除了不必要的部分。
问题是我想让这个 TableLayout
可以滚动,这样我的所有东西都可以显示出来。
我试图将这一行放在 TableLayout
中以使其可滚动:
android:isScrollContainer="true"
但它不能完成这项工作。 有什么办法吗?
最佳答案
把整个东西包起来:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none"
android:layout_weight="1">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
...
</ScrollView>
关于android - 如何制作可滚动的 TableLayout?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6513718/