按操作栏切断导航抽屉标题。但是我需要在操作栏上方放置导航抽屉。My Navigation drawer show in image
我的样式.xml
<item name="actionBarStyle">@style/MyActionBar</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="actionBarTheme">@style/AppTheme.AppBarOverlay</item>
<item name="actionBarPopupTheme">@style/AppTheme.PopupOverlay</item>
</style>
<style name="MyActionBar"
parent="@style/Widget.AppCompat.ActionBar.Solid">
<item name="android:background">@color/sapphire_blue_light</item>
<item name="background">@color/sapphire_blue_light</item>
</style>
我在抽屉布局中添加了alsio这行
android:fitsSystemWindows="true"
但是我需要如下图所示的结果。 Result image i need this
我的抽屉布局。 我定制的导航抽屉。
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
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"
tools:openDrawer="start">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:clickable="true"
android:visibility="gone"/>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/left_drawer_layout"
android:layout_height="match_parent"
android:layout_width="260dp"
android:layout_gravity="start"
android:fitsSystemWindows="true"
>
<LinearLayout
android:layout_width="260dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="@color/grey"
android:orientation="vertical"
>
<include layout="@layout/nav_header" />
<ListView
android:id="@+id/left_drawer_child"
android:layout_width="260dp"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
android:divider="@color/listview_side_view"
android:dividerHeight="0dp"
android:background="@color/listview_side_view"/>
</LinearLayout>
</android.support.design.widget.NavigationView>
答案 0 :(得分:0)
签出此项:Navigation Drawer
答案 1 :(得分:0)
我认为您的问题出在主题 MyActionBar 上:-
<style name="MyActionBar"
parent="@style/Widget.AppCompat.ActionBar.Solid">
<item name="android:background">@color/sapphire_blue_light</item>
<item name="background">@color/sapphire_blue_light</item>
</style>
删除后尝试:-
<item name="background">@color/sapphire_blue_light</item>
如果这不起作用,请尝试删除:-
<item name="android:background">@color/sapphire_blue_light</item>