Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Is Navigation Drawer from right hand side possible?

http://developer.android.com/training/implementing-navigation/nav-drawer.html

According to this doc, it doesn't say if it is possible to implement drawer from right hand side. Is it even possible? :(

like image 749
user2062024 Avatar asked Jun 17 '13 20:06

user2062024


People also ask

How do I customize my navigation drawer?

Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. Step 3 − Add the following code to res/layout/nav_header_main.

Where is the navigation drawer on my Android phone?

The navigation drawer is a UI panel that shows your app's main navigation menu. The drawer appears when the user touches the drawer icon in the app bar or when the user swipes a finger from the left edge of the screen.

How does navigation drawer work?

The navigation drawer slides in from the left and contains the navigation destinations for the app. The user can view the navigation drawer when the user swipes a finger from the left edge of the activity. They can also find it from the home activity by tapping the app icon in the action bar.


2 Answers

The NavigationDrawer can be configured to pull out from the left, right or both. The key is the order of appearance of the drawers in the XML declaration, and the layout_gravity attribute. Here is an example:

<android.support.v4.widget.DrawerLayout     android:id="@+id/drawer_layout"     android:layout_width="match_parent"     android:layout_height="match_parent" >      <FrameLayout         android:id="@+id/content"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:baselineAligned="false" >     </FrameLayout>      <!-- Left drawer -->      <ListView         android:id="@+id/left_drawer"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_gravity="left"         android:choiceMode="singleChoice" />      <!-- Right drawer -->      <ListView         android:id="@+id/right_drawer"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_gravity="right"         android:choiceMode="singleChoice" /> </android.support.v4.widget.DrawerLayout> 
like image 106
Jeshurun Avatar answered Oct 08 '22 14:10

Jeshurun


Here is the documentation on the drawer and it appears that you can configure it to pull out from the left or right.

Drawer positioning and layout is controlled using the android:layout_gravity attribute on child views corresponding to which side of the view you want the drawer to emerge from: left or right. (Or start/end on platform versions that support layout direction.)

http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html

like image 25
Larry McKenzie Avatar answered Oct 08 '22 12:10

Larry McKenzie