我需要將導航菜單項對齊到右側。 我讀了很多文章,問題和答案,但我找不到我的項目中有什麼問題。 這是我的xml:Android從右到左NavigationDrawer菜單項不是RTL
<?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="right">
<include
layout="@layout/content_activity_home"
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="right"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_activity_home"
app:menu="@menu/activity_home_drawer" />
這是activity_home_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/menu_account"
android:icon="@drawable/ic_profile"
android:title="حساب کاربری" />
<item
android:id="@+id/menu_logout"
android:icon="@drawable/ic_sign_out"
android:title="خروج از حساب" />
</group>
我可以讓自己的抽屜,從正確的,但仍然NavigationView的元素打開保持從左到右。你可以在這裏看到的結果:
正如你看到的菜單項不從右到左。如何讓他們rtl?
我這個代碼添加到我的應用程序,但我得到這個錯誤: –
@ Navid_pdp11「沒有重力LEFT發現抽屜視圖」給我你的代碼來解決它 – Fartab
我加方向RTL到我的抽屜,從右側開現在:) –