0

Please help me to make a navigation drawer with two menus and two different button to inflate the each Menu Items and click listener

Below is the Mock up and I want to make drawer like these Navigation Drawer First Button View

Navigation Drawer Second Button View

sohel.eco
  • 337
  • 2
  • 12

2 Answers2

1

Please check this, it will help to add a custom view. You can use tablayout and view pager

0

I have read your question very carefully and try to make this layout. Finally i make it .

try this code to achieve your layout

activity_home_navigation_activtiy

<?xml version="1.0" encoding="utf-8"?>
<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_home_navigation_activtiy"
    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">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <!--<include layout="@layout/nav_header_home_navigation" />-->

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight=".28"
            android:background="@color/colorPrimary"
            android:gravity="bottom"
            android:orientation="vertical"
            android:paddingLeft="15dp"
            android:paddingBottom="15dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <de.hdodenhof.circleimageview.CircleImageView
                    android:id="@+id/navigation_user_img"
                    android:layout_width="65dp"
                    android:layout_height="65dp"
                    android:src="@drawable/ic_launcher_foreground" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/navigation_user_name_tv"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text=" Picks App"
                    android:textColor="#504C4C"
                    android:textSize="17dp"
                    android:textStyle="italic" />

                <TextView
                    android:id="@+id/navigation_user_email_tv"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="First Last Name"
                    android:textColor="#000"
                    android:textSize="14sp" />
            </LinearLayout>

        </LinearLayout>

        <android.support.v4.widget.NestedScrollView
            android:id="@+id/navigation_nested"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight=".72"
            android:fillViewport="true">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="15dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="#fff"
                    android:gravity="center"
                    android:orientation="horizontal"
                    android:paddingTop="10dp"
                    android:paddingBottom="10dp">

                    <Button
                        android:id="@+id/usr_bt"
                        android:layout_width="wrap_content"
                        android:layout_height="fill_parent"
                        android:text="User"/>

                    <Button
                        android:id="@+id/admin_bt"
                        android:layout_width="wrap_content"
                        android:layout_height="fill_parent"
                        android:layout_marginLeft="10dp"
                        android:text="Admin"/>
                </LinearLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/user_recyler"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginBottom="5dp"
                        android:paddingLeft="15dp"
                        android:scrollbars="none" />
                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/admin_recyler"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginBottom="5dp"
                        android:paddingLeft="15dp"
                        android:scrollbars="none" />
                </RelativeLayout>
            </LinearLayout>
        </android.support.v4.widget.NestedScrollView>

    </LinearLayout>

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

   </android.support.v4.widget.DrawerLayout>

In this layout i try to make custom drawable . you can also customize according to your need

see screen shot

Custom Drawable

Thank You

white hills
  • 237
  • 1
  • 8