-2

Please anyone suggest me how to implement Navigation drawer swipe complete screen Of activity.

enter image description here

OR

enter image description here

Thanks in Advance.

***---------

Solution

--------*:** I found the solution for this.

Use this lib it is easy to use and handle

https://github.com/adamrocker/simple-side-drawer

SAndroidD
  • 1,745
  • 20
  • 33
  • check out this : http://stackoverflow.com/questions/37451594/slidingpanellayout-not-work-well-from-right-to-left-in-android/37452561#37452561 In my answer i have open panel on `Button` click. you have write on `ToggleButton` click. – Harshad Pansuriya Oct 07 '16 at 07:36
  • Hi in this eg Actionbar is not slide.how to handle this? I want Actionbar slide also – SAndroidD Oct 07 '16 at 11:18
  • visit this : http://stackoverflow.com/questions/11234375/how-did-google-manage-to-do-this-slide-actionbar-in-android-application – Harshad Pansuriya Oct 07 '16 at 11:24

1 Answers1

0

You can try use this layout for drawer activity.

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:elevation="7dp"
    >

    <RelativeLayout
        android:id="@+id/content_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

    </RelativeLayout>

    <FrameLayout
        android:id="@+id/drawer_holder"
        android:layout_width="@dimen/drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        >

        <ListView
            android:id="@+id/drawer_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />

    </FrameLayout>

</android.support.v4.widget.DrawerLayout>

And add DrawerLayout.DrawerListener to DrawerLayout like this.

drawerLayout.addDrawerListener(new DrawerLayout.DrawerListener() {
            @Override
            public void onDrawerSlide(View view, float slideOffset) {
                drawerView.setX(drawerHolder.getWidth() * (1 - slideOffset));
                contentLayout.setX(drawerHolder.getWidth() * slideOffset);
            }

            @Override
            public void onDrawerOpened(View view) {
            }

            @Override
            public void onDrawerClosed(View view) {
            }

            @Override
            public void onDrawerStateChanged(int newState) {
            }
        });

And after adding listner put this code.

drawerLayout.closeDrawer(drawerHolder);
mainDrawerView.setX(0);
contentLayout.setX(0);

Hope that will help.

MistaMek
  • 76
  • 2