Open P1NG2WIN opened 4 years ago
did you found any solution?
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;
}
}
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)