Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change menu item gravity to right in NavigationView

I need to put a menu item icon at right of text (by default it's on the left side) so how to change menu item gravity to right in NavigationView ?

because we can not custom NavigationView Items,I think it's impossible. can any one help me.

my menu xml file is:

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <group android:id="@+id/menu_group_2">
        <item
            android:id="@+id/menu_settings"
            android:title="Settings" />
        <item
            android:id="@+id/menu_about"
            android:title="About" />
    </group>
</menu>

and my navigationview in layout is

<android.support.design.widget.NavigationView
    android:id="@+id/vNavigation"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="right"
    android:background="#ffffff"
    app:headerLayout="@layout/view_global_menu_header"
    app:itemIconTint="#8b8b8b"
    app:itemTextColor="#666666"
    android:gravity="right"
    app:menu="@menu/drawer_menu" />
like image 688
ali Avatar asked Nov 10 '22 05:11

ali


1 Answers

try this: change Navigation layout gravity to:

android:layout_gravity="start"
like image 149
hassan Avatar answered Nov 14 '22 22:11

hassan