Android Layout: Horizontal Recyclerview inside a Vertical Recyclerview inside a Viewpager with Scroll Behaviors

前端 未结 6 572
一整个雨季
一整个雨季 2020-11-30 20:33

This is the app I\'m trying to build with all the elements mapped out below:

Everything works, however, I want the inner horizontal recyclerview not to capt

6条回答
  •  时光说笑
    2020-11-30 21:20

    Tested solution, use a custom NestedScrollView().

    Code:

    public class CustomNestedScrollView extends NestedScrollView {
        public CustomNestedScrollView(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        @Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
            if (ev.getAction() == MotionEvent.ACTION_DOWN) {
             // Explicitly call computeScroll() to make the Scroller compute itself
                computeScroll();
            }
            return super.onInterceptTouchEvent(ev);
        }
    }
    

提交回复
热议问题