の後ろにドロワーの背景に画像を持たせたい。このコードでは、の画像がメニューの前にあります。私は確信していませんが、私はこの特別な場合にFrameLayoutを使用することはできません。NavigationDrawer with background画像
画像もそのアスペクト比とその前にとどまるべき半透明の色を維持しなければなりません。この色は、あなたが新しいImageViewのように背景を設定しないでください/ @色によってmenuSemi
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:openDrawer="start">
<include
layout="@layout/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<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"
android:background="@color/menuSemi"
app:itemTextColor="@color/white"
app:itemIconTint="@color/white"
android:paddingTop="16dp"
style="@style/AppTheme.navigation"
app:menu="@menu/activity_main">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start">
<ImageView
android:id="@+id/drawer_bg"
android:src="@drawable/sidebar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="1"
android:scaleType="centerCrop"/>
</RelativeLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
メニューの属性を使用する代わりにコンテンツを表示する –