Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

[BUG] Broken in RecyclerView+SwipeRefreshLayout #63

Open
P1NG2WIN opened this issue Mar 30, 2020 · 2 comments
Open

[BUG] Broken in RecyclerView+SwipeRefreshLayout #63

P1NG2WIN opened this issue Mar 30, 2020 · 2 comments

Comments

@P1NG2WIN
Copy link
Contributor

P1NG2WIN commented Mar 30, 2020

Due to the fact that ExpansionLayout is inherited from NestedScrollView, when this element is placed in SwipeRefreshLayout it intercepts touch events and breaks the swipe (you can test it by yourself). In theory, this should be fixed through nestedScrollingEnabled = "false" but NestedScrollView does not allow this. How to fix it? (Why is there NestedScrollView at all, I think that if I needed it, I would add it to my layout)

@P1NG2WIN P1NG2WIN changed the title Broken in RecyclerView+SwipeRefreshLayout [BUG] Broken in RecyclerView+SwipeRefreshLayout Mar 30, 2020
@bhavin1994
Copy link

did you found any solution?

@mythoi
Copy link

mythoi commented May 16, 2021

Intercept related event by extends ExpansionLayout

 public class NoScrollExpansionLayout extends ExpansionLayout {

    public NoScrollExpansionLayout(Context context) {
        super(context);
    }

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

    public NoScrollExpansionLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        // 不拦截这个事件
        return false;
    }

    @SuppressLint("ClickableViewAccessibility")
    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        // 不处理这个事件
        return false;
    }

    @Override
    public boolean executeKeyEvent(@NonNull KeyEvent event) {
        // 不响应按键事件
        return false;
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants