我想使用DrawerLayout包含工具栏和我的内容布局,但是当我完成我的功能时,效果如下: effect1, effect2
这是我的xml:
<include layout="@layout/layout_toolbar"/>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_below="@+id/appToolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<!-- The content view -->
<RelativeLayout
android:id="@+id/user_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray_background1">
<FrameLayout
android:id="@+id/flay_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<include layout="@layout/layout_player"/>
</RelativeLayout>
<!-- Your drawer view. This can be any view, LinearLayout
is just an example. As we have set fitSystemWindows=true
this will be displayed under the status bar. -->
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer"/>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
和此:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/appToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true"
android:background="?attr/colorPrimary"
app:subtitleTextColor="?attr/colorAccent"
app:theme="@style/MyToolbar">
<!-- toolbar content -->
</android.support.v7.widget.Toolbar>
我不知道为什么工具栏会被状态栏覆盖,而不是低于它。
答案 0 :(得分:0)
尝试将主题更改为mainfest文件中的应用主题
android:theme="@style/Theme.AppCompat.Light.NoActionBar">