Trong ứng dụng của tôi, tôi muốn thay đổi nền menu chế độ xem điều hướng, nhưng tôi không biết cách thực hiện việc này. Tất cả các bài viết tôi đã xem giải thích làm thế nào để thay đổi từng mục trình đơn nền, nhưng tất cả tôi cần là để thay đổi toàn bộ nền của trình đơn.Điều hướng thay đổi Android Xem Menu Nền
Đây là những gì tôi muốn thay đổi, toàn bộ nền trắng:
activity_main_drawer.xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item android:id="@+id/nav_camara" android:icon="@android:drawable/ic_menu_camera"
android:title="Import" />
<item android:id="@+id/nav_gallery" android:icon="@android:drawable/ic_menu_gallery"
android:title="Gallery" />
<item android:id="@+id/nav_slideshow" android:icon="@android:drawable/ic_menu_slideshow"
android:title="Slideshow" />
<item android:id="@+id/nav_manage" android:icon="@android:drawable/ic_menu_manage"
android:title="Tools" />
</group>
<item android:title="Communicate">
<menu>
<item android:id="@+id/nav_share" android:icon="@android:drawable/ic_menu_share"
android:title="Share" />
<item android:id="@+id/nav_send" android:icon="@android:drawable/ic_menu_send"
android:title="Send" />
</menu>
</item>
</menu>
Liệu có cách nào để thay đổi nền trắng từ cách bố trí activity_main_drawer?
activity_main.xml:
<?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/app_bar_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" app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
Cảm ơn trước.
Cảm ơn bạn. Nó hoạt động hoàn hảo. – user3065901
nhưng, tôi cần nền hình ảnh, nếu tôi đặt như thế này, nó bị chồng chéo bởi tiêu đề – NarendraJi