CymChad / CymChad/BaseRecyclerViewAdapterHelper

item布局中使用了ScrollView,且Adapter实现了DraggableModule,导致拖动ScrollView后下次在RecyclerView控件区域内的点击一定会应用于item的拖拽

Open
#3,639 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
24.6k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

库使用的是 3.0.6版本的,我的demo地址:brvah-demo

为了解决item中的ScrollView无法拖动的问题,我自定义的ScrollView如下:

public class MyScrollView extends ScrollView {
    public MyScrollView(Context context) {
        super(context);
    }

    public MyScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    /**
     * 禁止父容器及上层容器拦截事件
     */
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        switch (ev.getAction()) {
            case MotionEvent.ACTION_DOWN:
                super.requestDisallowInterceptTouchEvent(true);
                break;
            case MotionEvent.ACTION_MOVE:
                super.requestDisallowInterceptTouchEvent(true);
                break;
        }
        return super.dispatchTouchEvent(ev);
    }
}

GIF效果图

我该怎么在拖动Scroll View的时候不去影响RecyclerView的触摸事件

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided brvah-demo and the custom MyScrollView.dispatchTouchEvent implementation. Reproduce the interaction between the item ScrollView, RecyclerView, and DraggableModule using version 3.0.6. Done means dragging the ScrollView no longer causes a later click in the RecyclerView area to start item dragging.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.