【发布时间】:2011-01-26 07:39:28
【问题描述】:
我有一个在 ScrollView 中的 TableLayout,所以我得到了垂直滚动。但是当列超过屏幕时,我也想要水平滚动。
我该怎么做?请帮忙。
谢谢, 法哈
【问题讨论】:
-
stackoverflow.com/questions/1399605/…这个链接它对我有用....
标签: android
我有一个在 ScrollView 中的 TableLayout,所以我得到了垂直滚动。但是当列超过屏幕时,我也想要水平滚动。
我该怎么做?请帮忙。
谢谢, 法哈
【问题讨论】:
标签: android
看看这个,它可能是你想要的。
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:src="@drawable/icon"/>
<ImageView android:src="@drawable/tube"/>
</TableRow>
<TableRow ....
</TableRow>
<TableRow ....
</TableRow>
</TableLayout>
</HorizontalScrollView>
</ScrollView>
【讨论】:
我想试试:
android:scrollbars="horizontal"
在您的视图的 xml 定义中,但是如果您使用的是滚动视图,它不支持水平滚动,因此不会显示栏...
【讨论】:
将属性放入滚动视图标签中。
android:scrollbars="horizontal"
【讨论】:
horizontalscrollview http://developer.android.com/reference/android/widget/HorizontalScrollView.html 在 1.5 中添加
【讨论】:
如上所述,将 HorizontalScrollView 放置在 ScrollView 内。 这是有关如何做到这一点的教程: http://androiddevblog.blogspot.com/2009/12/creating-two-dimensions-scroll-view.html
【讨论】: