CoordinatorLayout leaves empty space at the bottom after scrolling

后端 未结 3 1579
Happy的楠姐
Happy的楠姐 2021-02-05 08:25

I am trying to implement Google\'s newest design tricks with CoordinatorLayout and have problems with scrolling and parallax effect.

After Activity is displayed, everyt

相关标签:
3条回答
  • 2021-02-05 08:29

    For navigational flags reasons android:fitsSystemWindows="true" did not meet my needs.

    After some playing around I found that adding another CollapsingToolbarLayout with 0dp hieght does the trick.

    <android.support.design.widget.CollapsingToolbarLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_scrollFlags="scroll|snap" />
    
    0 讨论(0)
  • 2021-02-05 08:30

    I had the same problem and I noticed that every layout with this problem had

    android:fitsSystemWindows="true"
    

    on CoordinatorLayout

    Removing it fixed my problem everywhere.

    0 讨论(0)
  • 2021-02-05 08:43

    Try to add Toolbar inside yours CollapsingToolbarLayout:

     <android.support.design.widget.CollapsingToolbarLayout>
    
                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    android:minHeight="?attr/actionBarSize"
                    app:layout_collapseMode="pin"/>
    ...
    </android.support.design.widget.CollapsingToolbarLayout>
    

    Also try to add

    android:minHeight="?attr/actionBarSize"

    to Toolbar CollapsingToolbarLayout and AppBarLayout

    0 讨论(0)
提交回复
热议问题