Android Navigation Drawer RTL ขัดข้อง

ฉันใช้ appcompact สำหรับลิ้นชักการนำทาง ทุกอย่างทำงานได้อย่างสมบูรณ์ดังต่อไปนี้ แต่เมื่อฉันพยายามเปลี่ยนลิ้นชักจาก RTL โดยใช้ android:layout_gravity="start" แอปจะคอมไพล์ แต่เมื่อคลิกไอคอน มันขัดข้องกับความคิดใด ๆ ว่าเกิดจากอะไร ข้อขัดข้องและวิธีทำให้เป็น RTL

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical">

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="64dp"
    android:background="@color/color_primary"
    android:minHeight="?attr/actionBarSize" />

<android.support.v4.widget.DrawerLayout
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="start">
    <!-- Main layout -->
    <FrameLayout
        android:id="@+id/main_fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    <!-- The navigation drawer -->
    <ListView android:id="@+id/left_drawer"
              android:layout_width="240dp"
              android:layout_height="match_parent"
              android:layout_gravity="end"
              android:choiceMode="singleChoice"
              android:divider="@android:color/transparent"
              android:dividerHeight="0dp"
              android:background="#ccc"/>


</android.support.v4.widget.DrawerLayout>

here's the error log

Process: inducesmile.com.androidnavigationdrawer, PID: 15182
java.lang.IllegalArgumentException: No drawer view found with gravity LEFT
        at 

person h_code    schedule 30.09.2015    source แหล่งที่มา
comment
คุณสามารถวางบันทึกข้อผิดพลาดของคุณได้ไหม   -  person Muyide Ibukun    schedule 01.10.2015
comment
@Ibukun ฉันได้เพิ่มบันทึกข้อผิดพลาดแล้ว   -  person h_code    schedule 01.10.2015
comment
เหตุใดแรงโน้มถ่วงของเค้าโครง ListView ของคุณจึงสิ้นสุด ฉันไม่ได้ลองใช้ RTL มาก่อน ดังนั้น IDK ควรเริ่มต้นด้วยหรือไม่ แต่คุณสามารถลองดูได้   -  person mgokgoz    schedule 01.10.2015
comment
พบคำตอบที่นี่ stackoverflow.com/questions/30706552/   -  person h_code    schedule 01.10.2015
comment
คุณโพสต์รหัสกิจกรรมของคุณได้ไหม?   -  person Akash Singh    schedule 01.10.2015


คำตอบ (1)


อย่างที่คุณพูด คุณกำลังเปิดลิ้นชักการนำทางด้วยแอตทริบิวต์ start แทนที่จะเหลือไว้สำหรับความเข้ากันได้ของ RTL แต่ข้อยกเว้น Java ของคุณบอกว่าชั้นเรียนของคุณยังคงใช้ Gravity.LEFT แทน Gravity.START เช่นต้องเปลี่ยน:

myDrawerLayout.openDrawer(Gravity.LEFT);

to :

myDrawerLayout.openDrawer(Gravity.START);
person Ahmed    schedule 18.01.2021