0

I have the below design to implement for the Android Navigation App Drawer of the app and I am confused how to go about it.

In my design, there is a black strip on the left side, which also has an image. My query is how do I create that space in the app drawer ?

I tried to add a Layout inside the app drawer but couldn't. It only allows 'Items' and 'Groups' to be added. What are my possible options ?

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

    <group android:checkableBehavior="single">


        android:background="@color/colorBg"
        <item
            android:id="@+id/myasset"
            android:background="@color/colorBg"
            android:title="My Asset" />

        <item
            android:id="@+id/account"
            android:background="@color/colorBg"
            android:title="Account" />

        <item
            android:id="@+id/howitworks"
            android:background="@color/colorBg"
            android:title="How it works" />

        <item
            android:id="@+id/feedback"
            android:background="@color/colorBg"
            android:title="Feedback" />

        <item
            android:id="@+id/legal"
            android:background="@color/colorBg"
            android:title="Legal" />

        <item
            android:id="@+id/exit"
            android:background="@color/colorBg"
            android:title="Exit" />

    </group>



</menu>
geeky_monster
  • 8,672
  • 18
  • 55
  • 86

3 Answers3

0

When you create new project in Android Studio, there is an option that help you build NavigationDrawer.

Default activity_main.xml in layout

<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">

<include
    layout="@layout/app_bar_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<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:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_main"
    app:menu="@menu/activity_main_drawer" />

And you can do anything with activity_main_drawe or nav_header_main.

phatnhse
  • 3,870
  • 2
  • 20
  • 29
0

You can create custom navigation drawer. Try below tutorial :

Custom navigation drawer 1

Custom navigation drawer 2

Vidhi Dave
  • 5,614
  • 2
  • 33
  • 55
0

The solution that worked for me is Hamzeh Soboh's answer here.

https://stackoverflow.com/a/31716815/609235

geeky_monster
  • 8,672
  • 18
  • 55
  • 86