How to draw a line between menu item in navigation drawer

Dinesh Rijal

I want to highlight navigation items like this:

highlighted item in navigation menu

But my current menu looks like this:

not highlighted item in navigation menu

My menu.xml is

<?xml version="1.0" encoding="utf-8"?>
    <menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <group android:checkableBehavior="single">
    <group android:checkableBehavior="single">
        <item android:id="@+id/home"
            android:title="Home"
            android:icon="@drawable/ic_action_home_page"/></group>
    <group android:checkableBehavior="single">
        <item android:id="@+id/p_profile"
            android:title="Payment Profile"
            android:icon="@drawable/ic_action_payment_profile"/></group>
    <group android:checkableBehavior="single">
        <item android:id="@+id/p_history"
            android:title="Payment history"
            android:icon="@drawable/ic_action_payment_history"/></group>
    <group android:checkableBehavior="single">
        <item android:id="@+id/m_cards"
            android:title="My cards"
            android:icon="@drawable/ic_action_my_card"/></group>
        <group android:checkableBehavior="single">
            <item android:id="@+id/menu_friends"
                android:title="Friends"
                android:icon="@drawable/search_people"/></group>

    <group android:checkableBehavior="single">
        <item android:id="@+id/notification"
            android:title="Notification"
            android:icon="@drawable/ic_action_notification"/></group>
    <group android:checkableBehavior="single">
        <item android:id="@+id/about"
            android:title="About"
            android:icon="@drawable/ic_action_about_us"/></group>

    </group>
</menu>

How can I create the above highlight effect?

Vucko

Give each group a unique id like this:

<group android:checkableBehavior="single"
android:id="@+id/group1">

It'll draw those lines for you between any two groups.

EDIT: Since the line is now showing but it's black on the black background, refer to this question to see how to change the color of the divider.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to draw a line between menu item in navigation drawer

From Dev

Android draw a rectangle to navigation drawer menu item

From Dev

How to hide a navigation drawer menu item programmatically?

From Dev

How to start an activity on material navigation drawer menu item clicked

From Dev

How to add a collapsible menu item inside navigation drawer in android?

From Java

Change the color of a checked menu item in a navigation drawer

From Java

Changing text color of menu item in navigation drawer

From Java

Hide a Navigation Drawer Menu Item - Android

From Dev

Underline menu item in navigation drawer list

From Dev

Navigation drawer menu item with titles and sub titles

From Dev

Navigation Drawer Menu Item Title Color in Android

From Dev

Android Navigation drawer menu item icon color

From Dev

Navigation drawer menu item with titles and sub titles

From Dev

How to open sub menu after click on menu-item in Navigation drawer?

From Dev

How do I change Item title font color for an Item that contains a menu in Navigation Drawer

From Dev

How to add menu items runtime in Navigation Drawer?

From Dev

How to give color to menu items for Navigation drawer?

From Dev

How to style Menu Items in Navigation Drawer in Android?

From Dev

how to open the Navigation drawer on the click of menu Icon?

From Dev

How to pass data to navigation drawer item?

From Dev

Navigation drawer: How to know the current selected item?

From Dev

How to add action to a Navigation Drawer item?

From Dev

How to add a link to a navigation drawer item?

From Dev

How to select item navigation drawer from fragment

From Dev

How to add Spinner as an item in Navigation Drawer

From Dev

Navigation Drawer: How to change the colour of item category?

From Dev

Get selected menu item's index value in the navigation drawer

From Dev

Show menu item icons in actionbar while having navigation drawer

From Dev

Open new Activity after click item in navigation drawer menu

Related Related

  1. 1

    How to draw a line between menu item in navigation drawer

  2. 2

    Android draw a rectangle to navigation drawer menu item

  3. 3

    How to hide a navigation drawer menu item programmatically?

  4. 4

    How to start an activity on material navigation drawer menu item clicked

  5. 5

    How to add a collapsible menu item inside navigation drawer in android?

  6. 6

    Change the color of a checked menu item in a navigation drawer

  7. 7

    Changing text color of menu item in navigation drawer

  8. 8

    Hide a Navigation Drawer Menu Item - Android

  9. 9

    Underline menu item in navigation drawer list

  10. 10

    Navigation drawer menu item with titles and sub titles

  11. 11

    Navigation Drawer Menu Item Title Color in Android

  12. 12

    Android Navigation drawer menu item icon color

  13. 13

    Navigation drawer menu item with titles and sub titles

  14. 14

    How to open sub menu after click on menu-item in Navigation drawer?

  15. 15

    How do I change Item title font color for an Item that contains a menu in Navigation Drawer

  16. 16

    How to add menu items runtime in Navigation Drawer?

  17. 17

    How to give color to menu items for Navigation drawer?

  18. 18

    How to style Menu Items in Navigation Drawer in Android?

  19. 19

    how to open the Navigation drawer on the click of menu Icon?

  20. 20

    How to pass data to navigation drawer item?

  21. 21

    Navigation drawer: How to know the current selected item?

  22. 22

    How to add action to a Navigation Drawer item?

  23. 23

    How to add a link to a navigation drawer item?

  24. 24

    How to select item navigation drawer from fragment

  25. 25

    How to add Spinner as an item in Navigation Drawer

  26. 26

    Navigation Drawer: How to change the colour of item category?

  27. 27

    Get selected menu item's index value in the navigation drawer

  28. 28

    Show menu item icons in actionbar while having navigation drawer

  29. 29

    Open new Activity after click item in navigation drawer menu

HotTag

Archive