2

오른쪽에 탐색 메뉴 항목을 정렬해야합니다. 많은 기사와 질문 및 답변을 읽었지만 프로젝트에서 무엇이 잘못되었는지 찾을 수 없었습니다.오른쪽에서 왼쪽으로 안드로이드 NavigationDrawer 메뉴 항목이 없습니다

<?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입니다

<?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의 요소에서 열 수

왼쪽에서 오른쪽으로 남는다.

enter image description here

당신이 메뉴 항목을 보듯이 오른쪽에서 왼쪽으로하지 : 현재 결과를 볼 수 있습니다. 그들에게 rtl을 만드는 방법?

+0

나는 내 응용 프로그램에이 코드를 추가하지만 난이 오류가 점점 오전 : 이 Navid_pdp11 @ –

+0

"중력 왼쪽으로 발견되지 서랍보기"나는 내 서랍에 방향 RTL을 추가 그것을 – Fartab

+0

를 해결하기 위해 나에게 코드를 전송하지 않고 오른쪽에서 그것을 공개 지금 :) –

답변

6

시도 추가 안드로이드 : layoutDirection는 = "RTL"

<android.support.design.widget.NavigationView 
android:layoutDirection="rtl" 
android:id="@+id/navigation_view" 
android:layout_width="wrap_content" 
android:layout_height="match_parent" 
android:layout_gravity="right" 
android:fitsSystemWindows="true" 
app:headerLayout="@layout/nav_header_main" 
app:menu="@menu/activity_main_drawer" /> 

이 API 레벨 17 이상 작동합니다. 오래된 장치에는 트릭이 있습니다. 로이드 매니페스트인가 레벨 은 supportRtl = "FALSE" 설정과 레이아웃에 layout_gravity = "오른쪽" 세트. 이것은 올바르게 작동합니다.

+0

예, 작동합니다. @ Darwin에게 감사합니다. – Fartab

+0

해피 코딩 ... – darwin