Translucent/Transparent status bar + CoordinatorLayout + Toolbar + Fragment

后端 未结 8 1124
难免孤独
难免孤独 2020-12-05 07:23

I have following setup:

  • I\'m using AppCompat
  • MainActivity, that holds a fragment and has a toolbar, that\'s hiding when scrolling down
相关标签:
8条回答
  • 2020-12-05 08:08

    I had the same issue and my solution was add android:fitsSystemWindows="true" to the DrawerLayout

    <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"> 
    
    ....
    
    </android.support.v4.widget.DrawerLayout>
    
    0 讨论(0)
  • 2020-12-05 08:09

    as some users said, by setting android:fitsSystemWindows="false", the layout overlapped below statusbar.

    I solved it by setting android:fitsSystemWindows="true" and in CoordinatorLayout tag setting app:statusBarBackground="@android:color/transparent".

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