0

Is there any way to set the navigation drawer as visible always?.

So that the user knows that there is something on the right/left.

Like what you see in Hangouts app.

I know hangouts uses SlidePaneLayout, But anyone knows how to achieve this using Navigation Drawer?.

Shamnad P S
  • 1,095
  • 2
  • 15
  • 43
  • If you have the navigation drawer always visible, then there would be no more screen space left, I guess the only way this would work is on a tablet and you use 2 fragments, 1 for drawer, then 1 for the content. A good reference here http://stackoverflow.com/questions/17133541/navigation-drawer-set-as-always-opened-on-tablets – Jack May 24 '14 at 16:02
  • NavigationDrawer wasn't meant for this purpose. Either use the SlidingPaneLayout or create your own layout that has the behaviors you want. – Karakuri May 24 '14 at 16:54
  • 1
    I want a small part of navigation drawer to be visible, like a handle. So that the user will notice it. – Shamnad P S May 24 '14 at 16:55
  • @Karakuri, I tried SlidingPaneLayout , but in closed state it covers the whole window. I need a bit of background to be visible. – Shamnad P S May 24 '14 at 16:56
  • Again, you can create your own layout with the behaviors that you want. Maybe the source code for SlidingPaneLayout will give you some ideas: https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v4/java/android/support/v4/widget/SlidingPaneLayout.java – Karakuri May 24 '14 at 17:16
  • Alternatively, you can have the sliding pane "open" the first time the user uses the app so that they see that it's there, and then you won't need to devote space on a handle. – Karakuri May 24 '14 at 17:16
  • @Karakuri, yes i have tried that , In open state i could see tha handle and drag the pane. But when closed it covers the whole window, i still want to see a bit of the background in the closed state. – Shamnad P S May 25 '14 at 02:20
  • Possible duplicate of [Navigation Drawer: set as always opened on tablets](https://stackoverflow.com/questions/17133541/navigation-drawer-set-as-always-opened-on-tablets) – Bertram Gilfoyle Jun 01 '18 at 17:05

1 Answers1

1

Got It!!.. Simplicity at its best. No libraries, No complicated codes. Use SimplePaneLayout.

Just set the android:layout_marginLeft to a suitable value. :) Awesome :)

<android.support.v4.widget.SlidingPaneLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/slidingpanelayout">

        <LinearLayout android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:background="#CCC"
                  android:orientation="horizontal"
                  android:id="@+id/fragment_firstpane"/>

        <LinearLayout android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:background="#000"
                  android:orientation="horizontal"
                  android:layout_marginLeft="40dp"
                  android:id="@+id/fragment_secondpane"/>

    </android.support.v4.widget.SlidingPaneLayout>
Shamnad P S
  • 1,095
  • 2
  • 15
  • 43