问题描述
通常,当上的 DrawerLayout
,抽屉将关闭,触摸消耗的内容区域pressing。有没有一种方法,以prevent这一点,并传递到内容区域的触摸事件?
Normally when pressing on the content area of the DrawerLayout
, the drawer will close and the touch is consumed. Is there a way to prevent this and pass the touch event on to the content area?
谢谢!
推荐答案
我结束了对矫正DrawerLayout。
I ended up modifing DrawerLayout.
在方法 onInterceptTouchEvent(MotionEvent EV)
你必须prevent interceptForTap
被设置为真正。一种方法是除去以下的条件
In the method onInterceptTouchEvent(MotionEvent ev)
you'll have to prevent interceptForTap
being set to true. One way is to remove the following conditional.
if (mScrimOpacity > 0 &&
isContentView(mLeftDragger.findTopChildUnder((int) x, (int) y))) {
interceptForTap = true;
}
这将使触摸贯穿。
要具备抽屉不会关闭,您可以设置抽屉锁模式 LOCK_MODE_LOCKED_OPEN
。
To have the drawer not close you can set the drawer lock mode to LOCK_MODE_LOCKED_OPEN
.
这篇关于从内容区域处理触及prevent DrawerLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!