How to disable scrolling of AppBarLayout in CoordinatorLayout?

前端 未结 5 1801
挽巷
挽巷 2020-12-02 23:34

I have MapFragment with parallax effect inside AppBarLayout:

I want to disable scrolling on AppBarLayout, because it

5条回答
  •  余生分开走
    2020-12-02 23:59

    So after two hours of trying I have found a solution, which is pretty simple. I just needed to extend CoordinatorLayout and override OnInterceptTouchEvent method so the class looks like this:

    public class NonTouchableCoordinatorLayout extends CoordinatorLayout {
    public NonTouchableCoordinatorLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    
    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        return false;
    }
    

    }

提交回复
热议问题