I'm trying to make navigation view open from Right-to-Left, but I fail. I've seen many questions, and what they say seems to be incomplete.
Here's what I've done based on these questions:
- Creating a new project in Android Studio
- Selecting the Navigation Drawer Activity template as the default template for the main activity (naming it
MainActivity
) - Going to
activity_main.xml
and settinglayout_gravity="right"
forNavigationView
- Then in the
MainActivity.java
set allGravityCompat.START
s toGravity.RIGHT
But when I run the app, and click on the drawer toggle inside the action bar, I get this error:
java.lang.IllegalArgumentException: No drawer view found with gravity LEFT
at android.support.v4.widget.DrawerLayout.openDrawer(DrawerLayout.java:1651)
at android.support.v4.widget.DrawerLayout.openDrawer(DrawerLayout.java:1637)
at android.support.v7.app.ActionBarDrawerToggle.toggle(ActionBarDrawerToggle.java:293)
at android.support.v7.app.ActionBarDrawerToggle$1.onClick(ActionBarDrawerToggle.java:202)
at android.view.View.performClick(View.java:5610)
at android.view.View$PerformClick.run(View.java:22265)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Please help.