有没有可能以某种方式使用安卓的SlidingPaneLayout来做它所做的事情,而不是从相反的方面?
也就是说,我想要在屏幕的右侧而不是左侧滑动边框,以显示第二个窗格,它会从右侧而不是左侧滑入。
理想情况下,我正在寻找一种方法来做这个布局,或它的修改。
发布于 2013-09-13 01:19:14
我认为这是可能的,就像从底层做的一样。检查它和原始代码之间的区别,你就会知道怎么做了。
发布于 2014-09-02 14:55:40
我还没有尝试过,但我不明白为什么它不能与这样的东西一起工作:
<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"
/>
这样,您的ListFragment就会在右侧。现在,你想先打开哪一个取决于你自己。如果您想首先显示左侧,则需要在MainActivity的onCreate方法中包含类似以下内容:
private SlidingPaneLayout mSlidingLayout;
mSlidingLayout = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout);
mSlidingLayout.setPanelSlideListener(new SliderListener());
mSlidingLayout.openPane();尽管我迟到了,但我希望这能帮上忙。
https://stackoverflow.com/questions/18059416
复制相似问题