public class MyRecycleView extends RecyclerView { private float startY; private float startX; public MyRecycleView(Context context) { this(context, null); } public MyRecycleView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public MyRecycleView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { int action = ev.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: getParent().requestDisallowInterceptTouchEvent(true); break; case MotionEvent.ACTION_MOVE: break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: getParent().requestDisallowInterceptTouchEvent(false); break; } return super.onInterceptTouchEvent(ev); } }
recyclerView 嵌套水平recyclerview,水平recyclerview滑动时,禁止垂直recyclerview滑动
最新推荐文章于 2024-05-06 17:35:51 发布