如何制作可滚动的 TableLayout? [英] How to make a scrollable TableLayout?
本文介绍了如何制作可滚动的 TableLayout?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请看这里的 XML 代码:
Look at the XML code here please:
<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
成为可滚动的,这样我的所有东西都可以显示.
My code is much longer than that but I just eliminated the unnecessary parts.
The problem is I want to make this TableLayout
a scrollable so that all of my stuff can be shown.
我试图将这一行放在 TableLayout
中以使其可滚动:
I tried to put this line in the TableLayout
in order to make it scrollable:
android:isScrollContainer="true"
但它并没有完成这项工作.有办法吗?
But it does NOT do the job. Is there a way ?
推荐答案
将整个内容封装在:
<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>
这篇关于如何制作可滚动的 TableLayout?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文