I need to put a menu item at right of text how to change menu item gravity to right in NavigationView ?
Asked
Active
Viewed 3,859 times
1
-
maybe it help http://stackoverflow.com/questions/31103697/how-to-change-the-icons-direction-for-menu-items-in-a-navigationview?rq=1 – Setmax Aug 30 '16 at 08:09
4 Answers
0
try this:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:id="@+id/menu_group_2">
<item
android:id="@+id/menu_settings"
android:icon="@drawable/YourImage"
android:title="Settings" />
<item
android:id="@+id/menu_about"
android:icon="@drawable/YourImage"
android:title="About" />
</group>
</menu>
and change Navigation layout gravity to:
android:layout_gravity="start"
Navigation View:
<android.support.design.widget.NavigationView
android:id="@+id/vNavigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#ffffff"
app:headerLayout="@layout/view_global_menu_header"
app:itemIconTint="#8b8b8b"
app:itemTextColor="#666666"
app:menu="@menu/drawer_menu" />

Michele Lacorte
- 5,323
- 7
- 32
- 54
-
-
post your Activity.java and full activity_layout.xml because the code for navigation view is this, and it work. – Michele Lacorte Sep 15 '15 at 09:00
0
You have to add android:supportsRtl="true"
into application tag in your AndroidMainfest.xml and set NavigationView gravity to start android:layout_gravity="start"

Mohamad Shaker
- 1,466
- 2
- 14
- 21
0
i'm sure this will help you...
Try adding these attributes to NavigationView
in your layout file.
android:layoutDirection="rtl"
android:textDirection="rtl"
Screenshot
Note: It seems its working on API 17 and higher

Ali Sherafat
- 3,506
- 2
- 38
- 51