Múltiplas RecyclerView não rolando a folha inferior
// https://stackoverflow.com/a/61890073/11292068
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;
public class DisallowInterceptView extends LinearLayout {
public DisallowInterceptView(Context context) {
super(context);
requestDisallowInterceptTouchEvent(true);
}
public DisallowInterceptView(Context context, AttributeSet attrs) {
super(context, attrs);
requestDisallowInterceptTouchEvent(true);
}
public DisallowInterceptView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
requestDisallowInterceptTouchEvent(true);
}
public boolean dispatchTouchEvent(MotionEvent ev) {
getParent().requestDisallowInterceptTouchEvent(true);
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_MOVE:
requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
requestDisallowInterceptTouchEvent(false);
break;
}
return super.onTouchEvent(event);
}
}
Fair Finch