-4

customizing the default navigation drawer in android like image below or from opening from bottom

screenshot

Community
  • 1
  • 1

2 Answers2

0

Here is the main activity layout

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 
 xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".NavigationDrawerExample">


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

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="Content" />

</LinearLayout>

<android.support.design.widget.NavigationView
    android:layout_width="250dp"
    android:background="@android:color/transparent"
    android:layout_height="match_parent"
    android:layout_gravity="start">

    <include layout="@layout/nav_view" />

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

And this is the navigationview.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:gravity="bottom"
android:background="@android:color/transparent"
android:orientation="vertical">

<android.support.v7.widget.CardView
    app:cardElevation="5dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

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

     <ImageView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:src="@mipmap/ic_launcher" />

     <TextView
         android:padding="16dp"
         android:text="One"
         android:layout_width="match_parent"
         android:layout_height="wrap_content" />
     <TextView
         android:padding="16dp"
         android:text="One"
         android:layout_width="match_parent"
         android:layout_height="wrap_content" />
     <TextView
         android:padding="16dp"
         android:text="One"
         android:layout_width="match_parent"
         android:layout_height="wrap_content" />
     <TextView
         android:padding="16dp"
         android:text="One"
         android:layout_width="match_parent"
         android:layout_height="wrap_content" />

 </LinearLayout>
</android.support.v7.widget.CardView>

Jay Thummar
  • 2,281
  • 1
  • 14
  • 22
  • May be you have to remove transparent shadow otherwise it is the layout exmple using such design stuff you can create your own – Jay Thummar Jun 02 '18 at 18:11
0

You need to use SlidingRootNav use this libs

compile 'com.yarolegovich:sliding-root-nav:1.1.0'

Here is the reference https://github.com/yarolegovich/SlidingRootNav

    new SlidingRootNavBuilder(this)
    .withMenuLayout(R.layout.menu_left_drawer)
    .inject();
Gowthaman M
  • 8,057
  • 8
  • 35
  • 54