iTu*_*rki 51 android scroll android-tablelayout
请看这里的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>
Run Code Online (Sandbox Code Playgroud)
我的代码比这长得多,但我只是删除了不必要的部分.问题是我想让它成为TableLayout
一个可滚动的,这样我的所有东西都可以显示出来.
我试图将此行放入其中TableLayout
以使其可滚动:
android:isScrollContainer="true"
Run Code Online (Sandbox Code Playgroud)
但它没有做到这一点.有办法吗?
cit*_*onn 100
把整个事情包括在内:
<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>
Run Code Online (Sandbox Code Playgroud)
Art*_*718 19
从技术上讲,您不需要ScrollView中的LinearLayout:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none"
android:layout_weight="1">
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
android:isScrollContainer="true">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<--!Everything Else You Already Have-->
</TableRow>
</TableLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
一旦你在ScrollView中占据足够的空间,滚动效果就会激活(有点像HTML TextArea,一旦你有足够的文本行,滚动就会激活.)
您也可以嵌套ScrollView,但在ScrollView中有足够的内容之后,您又感觉不到滚动效果.
归档时间: |
|
查看次数: |
66252 次 |
最近记录: |