We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
header完全展开时会拦截横向滑动的事件,但是把下方vp稍微拉起一点后尝试向左右滑动就不会拦截了。然后这种情况下(header未完全关闭时)拉起vp的话vp还是会有上下左右的滑动,但是我看您的demo就不会出现这种情况,可以请教一下吗? 我和你的onIntercept写法是一样的,但是因为down->move->..->move后,currX - lastX 就小于currY - lastY,拦截不了了..不知道您的demo里这个dx是传到哪里消费掉了orz
The text was updated successfully, but these errors were encountered:
我用了这么一个解决方法:
override fun onInterceptTouchEvent( parent: CoordinatorLayout, child: View, ev: MotionEvent ): Boolean { when (ev.actionMasked) { MotionEvent.ACTION_DOWN -> { lastX = ev.x } MotionEvent.ACTION_MOVE -> { val currY = ev.y val headerOpening = // judge whether header is opening if (headerOpening){ // make horizontal movement is 0 ev.setLocation(lastX, currY) } } } return super.onInterceptTouchEvent(parent, child, ev) }
可以的话还是想请教下您是怎么处理这个问题的, 我在header的behavior里也没有看到有dx的消费
Sorry, something went wrong.
这个的处理在 UcNewsContentBehavior.java 的 onInterceptTouchEvent 里面,header 完全展开状态下如果尝试左右滑动,会直接拦截掉,然后 CoodrinatorLayout 就不会分发给 vp 处理了,所以 vp 这种状态下是不能左右滑动的,但是稍微上拉一点就不满足拦截条件了,所以又可以左右滑动了
No branches or pull requests
header完全展开时会拦截横向滑动的事件,但是把下方vp稍微拉起一点后尝试向左右滑动就不会拦截了。然后这种情况下(header未完全关闭时)拉起vp的话vp还是会有上下左右的滑动,但是我看您的demo就不会出现这种情况,可以请教一下吗?
我和你的onIntercept写法是一样的,但是因为down->move->..->move后,currX - lastX 就小于currY - lastY,拦截不了了..不知道您的demo里这个dx是传到哪里消费掉了orz
The text was updated successfully, but these errors were encountered: