Gallery inside a ScrollView - vertical scrolling doesn't work
There were some questions about ScrollViews inside Gallery etc., however I have something exactly opposite here and I can't find any solution.
The problem: I have multiple Galleries in one ScrollView. Horizontal scrolling for Galleries works fine (nothing changed here, just a standard Gallery class from SDK), but vertical scrolling for ScrollView, for whole activity does not. It looks like Galleries are intercepting touch events. Could you please help me to solve this out?
This is my layout 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
开发者_StackOverflow 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>
Thanks!
You could make the top RelativeLayout (which contains all the other RelativeLayouts), to be about 30-40 dp smaller in width then the ScrollView. This allows the user to touch an area of the ScrollView which is not covered by a Gallery, so the Touch is not intercepted and should work as expected.
精彩评论