user3065901
user3065901

Reputation: 4778

Android Navigation View Align Menu Items

In my app i have a nvigation view with some menu items. I want to align some of them to the center of the view. How can i achieve this correctly?

This is what i want:

enter image description here

activity_main_drawer.xml:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<group android:checkableBehavior="single">
    <item android:id="@+id/nav_camara" android:icon="@android:drawable/ic_menu_camera"
        android:title="Import" />
    <item android:id="@+id/nav_gallery" android:icon="@android:drawable/ic_menu_gallery"
        android:title="Gallery" />
    <item android:id="@+id/nav_slideshow" android:icon="@android:drawable/ic_menu_slideshow"
        android:title="Slideshow" />
    <item android:id="@+id/nav_manage" android:icon="@android:drawable/ic_menu_manage"
        android:title="Tools" />
</group>

<item android:title="Communicate">
    <menu>
        <item android:id="@+id/nav_share" android:icon="@android:drawable/ic_menu_share"
            android:title="Share" />
        <item android:id="@+id/nav_send" android:icon="@android:drawable/ic_menu_send"
            android:title="Send" />
    </menu>
</item>

</menu>

Thanks in advance.

Upvotes: 0

Views: 1747

Answers (1)

michal.luszczuk
michal.luszczuk

Reputation: 2903

As far as I know this is not possible in easy way.

You could find or navigate through views hierarchy to find views or textviews you want to center. But i think NavigationView is not designed to align things other than left or right

Upvotes: 1

Related Questions