Toolbar will not collapse with Scrollview as child of CoordinatorLayout

后端 未结 5 1339
南笙
南笙 2020-12-23 18:52

I am trying to follow the Google Docs on using the CoordinatorLayout but i am having an issue with the ScrollView inside the CoordinatorLayout. Basically, the Toolbar normal

5条回答
  •  难免孤独
    2020-12-23 19:47

    Use a NestedScrollView instead of a regular ScrollView when using CoordinatorLayout.

    To make the CollapsingToolbarLayout scroll you can trigger the scroll behavior by setting a minimum height of the child Layout of the NestedScrollView to *1000dp.

    android:minHeight="1000dp"
    

    Layout:

    
    
        
        
    
    
    

    *SupportDesignDemos example here: https://github.com/android/platform_development/blob/master/samples/SupportDesignDemos/res/layout/include_appbar_scrollview.xml

提交回复
热议问题