1

I need to put a menu item at right of text how to change menu item gravity to right in NavigationView ?

hassan
  • 29
  • 1
  • 6
  • 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 Answers4

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
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

enter image description here

Note: It seems its working on API 17 and higher

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

I think it's impossible. You can use Navigation Drawer for this purpose.