滚动型内滚动的自定义视图 [英] Custom scrollable View within ScrollView
问题描述
我创建了一个实现 GestureListener
和所有必要的逻辑,允许一些视图内滚动自定义视图。因为我不把视图为其他一些滚动查看它工作正常,只要,例如滚动型
。
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?
推荐答案
您可以要求你的滚动容器无法从查看
致电<$ C $拦截触摸事件C> requestDisallowInterceptTouchEvent(真)就可以了,当你收到你的查看一个
ACTION_DOWN
事件
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
.
这篇关于滚动型内滚动的自定义视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!