Is it possible to somehow use Android's SlidingPaneLayout to do exactly what it does except from the opposite side?
I.e. I want to bezel swipe the right-hand side of the screen instead of the left-hand side to expose the second pane, and it slides in from the right instead of the left.
Ideally I'm looking for a way to do it with this layout, or a modification of it.
i think it is possible, just as this one did it from the bottom. check the difference between it and the original code, and you will know how to do it.
I have not tried it yet but i dont see why it would't work with something like this:
<android.support.v4.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sliding_pane_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="@+id/content_pane"
android:name="package.DetailFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_marginRight="60dp"
/>
<fragment
android:id="@+id/list_pane"
android:name="package.MyListFragment"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="left"
/>
This way you would have the ListFragment on the right side. Now which one you want to have opened first is up to you. If you wanted to have the left side showing first you'd need to have something like this in the onCreate method of your MainActivity:
private SlidingPaneLayout mSlidingLayout;
mSlidingLayout = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout);
mSlidingLayout.setPanelSlideListener(new SliderListener());
mSlidingLayout.openPane();
even tho i'm late i hope this helps.
来源:https://stackoverflow.com/questions/18059416/using-slidingpanelayout-from-the-right-hand-side