Skip to content Skip to sidebar Skip to footer

Google Map With Collapsingtoolbar And Nestedscrollview

I am developing app like UBER. First scrolling of custom marker was working fine on map. After that i added NestedScrollView just like UBER. But map scrolling gesture is conflictin

Solution 1:

After long search i found that there is bug in design library and it is already reported

Its mentioned there that

Scrollable containers in an AppBarLayout have never been officially supported.

If the next release have a look at AppBarLayout.Behavior.DragCallback which allows you to disable the drag handling if you need.

This DragCallback method stop drag effect in appbar layout content and NestedScrollView is working like charm.

AppBarLayoutappBarLayout= (AppBarLayout) findViewById(R.id.appbar_layout);
    CoordinatorLayout.LayoutParamsparams= 
            (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams();
    AppBarLayout.Behaviorbehavior=newAppBarLayout.Behavior();
    behavior.setDragCallback(newAppBarLayout.Behavior.DragCallback() {
        @OverridepublicbooleancanDrag(AppBarLayout appBarLayout) {
            returnfalse;
        }
    });

Post a Comment for "Google Map With Collapsingtoolbar And Nestedscrollview"