Ad

How To Add A Frame Or Divider Each Item Of Navigation Drawer?

I want to customize my navigation drawer items like this

My navigation view like this ;

<android.support.design.widget.NavigationView
            android:id="@+id/nav_view"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:background="@color/colorPrimary"
            android:fitsSystemWindows="true"
            app:headerLayout="@layout/nav_header_main"
            app:itemIconTint="@color/colorWhite"
            app:itemTextColor="@color/colorWhite"
            app:menu="@menu/activity_main_drawer" />

items are like this

I just wonder that how to add frame or divider? Do I need to set a custom layout to my navigation drawer or what ? If you want some more info let me know. Please help me thanks..

Ad

Answer

Create a custom border drawable.

 <android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    **app:itemBackground="@drawable/customer_border"**
    android:layout_gravity="start">

</android.support.design.widget.NavigationView>

inside navigation menu

Ad
source: stackoverflow.com
Ad