【发布时间】:2014-02-14 09:48:10
【问题描述】:
在我的 Android 应用中,我有以下布局:
<CustomRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.v4.view.ViewPager
android:id="@+id/image_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<OverScrollBounceScrollView
android:id="@+id/scrollview"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<LinearLayout
android:id="@+id/user_profile_scroll_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<RelativeLayout
android:id="@+id/dummy_viewport"
android:layout_width="match_parent"
android:layout_height="350dp"
>
</RelativeLayout>
<LinearLayout
android:id="@+id/scroll_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/white"
>
...some content
</LinearLayout>
</LinearLayout>
</OverScrollBounceScrollView>
</CustomRelativeLayout>
看起来是这样的:
http://i.stack.imgur.com/lzL5u.png
我的目标是:
- 当我在 Y 方向滚动时,我希望滚动视图接管并正常滚动
- 当我在 X 方向滚动时,我希望滚动视图下的 viewpager 接管
现在的问题是,滚动视图接受了所有事件,根本无法访问 viewpager。
关于如何解决这个问题的任何想法?
【问题讨论】:
标签: android touch scrollview android-custom-view android-event