Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two Navigation Drawer on same Activity

Is it possible to configurate two Navigation Drawers on the same activity, one from the left and the other from the right?

like image 806
Ruben Flores Avatar asked Apr 28 '15 13:04

Ruben Flores


1 Answers

You can use drawer layout

 <android.support.v4.widget.DrawerLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/drawer_layout"
   android:layout_width="match_parent"
   android:layout_height="match_parent">
   <!-- The main content view -->

   <FrameLayout
      android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<!-- The navigation drawer -->
    <ListView android:id="@+id/left_drawer"
       android:layout_width="240dp"
       android:layout_height="match_parent"
       android:layout_gravity="start"
       android:choiceMode="singleChoice"
       android:divider="@android:color/transparent"
       android:dividerHeight="0dp"
       android:background="#111"/>


   <ListView android:id="@+id/right_drawer"
       android:layout_width="240dp"
       android:layout_height="match_parent"
       android:layout_gravity="end"
       android:choiceMode="singleChoice"
       android:divider="@android:color/transparent"
       android:dividerHeight="0dp"
       android:background="#111"/>
 </android.support.v4.widget.DrawerLayout>

ALso check the documantation https://developer.android.com/training/implementing-navigation/nav-drawer.html

Make sure you are using toolbar not action bar

like image 138
Yousef Zakher Avatar answered Oct 02 '22 08:10

Yousef Zakher