【发布时间】:2011-09-20 18:44:58
【问题描述】:
有一些关于 Gallery 等中的 ScrollViews 的问题,但是我这里有一些完全相反的东西,我找不到任何解决方案。
问题:我在一个 ScrollView 中有多个画廊。画廊的水平滚动工作正常(这里没有改变,只是来自 SDK 的标准画廊类),但 ScrollView 的垂直滚动,对于整个活动没有。看起来画廊正在拦截触摸事件。你能帮我解决这个问题吗?
这是我的布局 xml:
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollview_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:id="@+id/layout_home"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
...>
<Button
.../>
<Gallery
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gallery_..."
android:layout_width="fill_parent"
android:layout_height="wrap_content"
... />
<TextView
... />
</RelativeLayout>//this layout is repeated few times, because I have multiple galleries
</RelativeLayout>
</ScrollView>
谢谢!
【问题讨论】:
-
你不能可靠地将可滚动的东西放在其他可滚动的东西中。
-
即使父母是垂直的,孩子是水平的?
-
同样,问题是可靠。是的,有时将一个方向滚动的东西放在另一个方向滚动的东西里面是可行的。将两个在同一方向滚动的东西几乎不起作用。
标签: android android-layout android-gallery android-scrollview