RtlNavigationView
RtlNavigationView is an extension of Android support library's NavigationView which enables you to have an Rtl NavigationView which is especially useful in apps that are in Right-To-Left languages like Persian.
How to Use
Add this line of code in your dependencies:
compile 'ir.basalam.rtlnavigationview:rtl-navigationview:1.2'
Define your items in a menu resource file. For example I have a menu file called activity_main_drawer.xml:
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_camera"
android:icon="@drawable/ic_menu_camera"
android:title="??????" />
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/ic_menu_gallery"
android:title="?????" />
<item
android:id="@+id/nav_slideshow"
android:icon="@drawable/ic_menu_slideshow"
android:title="????????" />
<item
android:id="@+id/nav_manage"
android:icon="@drawable/ic_menu_manage"
android:title="??????" />
<item android:title="????????">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_menu_share"
android:title="?? ?????? ?????" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/ic_menu_send"
android:title="?????" />
</menu>
</item> </menu>
Then add RtlNavigationView to your layout and pass your menu file to it like the example below:
<ir.basalam.rtlnavigationview.RtlNavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:fitsSystemWindows="true"
app:rtl_menu="@menu/activity_main_drawer"/>
If you don't know how to handle NavigationView item clicks you can check the sample app source code.