Custom scrollable View within ScrollView

2019-09-18 16:16发布

I created a custom View that implements a GestureListener and all the necessary logic to allow for some scrolling within the View. It works fine, as long as I do not put the View into some other scrollable View, e.g., a ScrollView.

If I wrap my View with a ScrollView, the touch events seem to be consumed by the ScrollView completely and are not handed through to my custom View. How can I tell the ScrollView that it should only consume touch events, if the touching happens outside of one of its children?

1条回答
Juvenile、少年°
2楼-- · 2019-09-18 16:36

You can request your scrollable container to not intercept touch events from your View by calling requestDisallowInterceptTouchEvent(true) on it when you receive an ACTION_DOWN event on your View.

查看更多
登录 后发表回答