现在style中设置主题,添加如下代码
<item name="android:windowTranslucentStatus">true</item>
然后在布局文件中添加如下代码
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"//这句代码是填充满状态栏,注意必须是在DrawerLayout中fitsSystemWindows属性才会生效>
...
</android.support.v4.widget.DrawerLayout>