Using SlidingPaneLayout from the right-hand side?

喜你入骨 提交于 2019-12-05 03:53:23

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!