Reputation: 299
I'm looking for a way to reproduce the navigation drawer of iOS on Android.
I can't figured out how to reproduce it.
The Navigation Drawer on iOS slide all the previous page and keep a little part of it on screen like this:
Meanwhile the android Navigation Drawer goes over the previous page and hide it like this:
Android like Navigation Drawer
Is it just possible ?
Upvotes: 2
Views: 1713
Reputation: 3193
Affirmative, it's very much possible in Android. Add the following in your build.gradle
file:
dependencies {
implementation 'com.infideap.drawerbehavior:drawer-behavior:0.2.2'
}
Use android.support.design.widget.NavigationView
inside your layout with com.infideap.drawerbehavior.AdvanceDrawerLayout
to achieve this type of behavior like this:
<com.infideap.drawerbehavior.AdvanceDrawerLayout 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"
android:background="@color/colorWhite"
tools:openDrawer="start">
<include
layout="@layout/app_bar_default"
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"
android:background="@color/colorWhite"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
</com.infideap.drawerbehavior.AdvanceDrawerLayout>
For more on the implementations & sample demos, please follow this link. Hope this helps!
Upvotes: 1