why my DrawerLayout drawer header can't reach under statusbar?

376 views Asked by At

why my DrawerLayout drawer header can't reach under statusbar?

here is mytheme:

<!-- Application theme. -->
<style name="AppTheme" parent="AppTheme.Base">

    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <!-- Status bar color -->
    <item name="android:statusBarColor">@color/base_color_half</item>

    <item name="android:windowTranslucentNavigation">true</item>
    <!-- Navigation bar color -->
    <item name="android:navigationBarColor">@color/base_color_half</item>
</style>

and my drawer view define:

<!-- Sid Drawer -->
<!-- this layout can reach under statusbar -->
<LinearLayout
    android:id="@+id/drawer_view"
    android:layout_width="270dp"
    android:layout_height="match_parent"
    android:layout_gravity="start|top"
    android:background="@android:color/white"
    android:clickable="true"
    android:fitsSystemWindows="true"
    android:orientation="vertical">

     <!-- but this layout (as header) can not reach under statusbar, just above Toolbar -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/drawer_header">

        <TextView
            style="@style/DefaultTextStyle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:padding="@dimen/padding_base"
            android:text="@string/app_name" />
    </LinearLayout>
</LinearLayout>

Drawer background is white, and i add a linearlayout as a header, then i get this issue..

I'm sorry but i can't upload image on my level..

1

There are 1 answers

1
Simas On

Since status bar is a part of the system window, set the fits attribute to false:

android:fitsSystemWindows="false"