Android. 滑动面板未完全关闭

3
我需要在关闭状态下滑动面板并非完全关闭。
(示例http://i.stack.imgur.com/S2Hj1.png
如何做到这一点?
xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <com.regulus.client.android.controls.SlidingPaneLayoutTouchOff
        android:id="@+id/work_area"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical" >

        <!-- sliding panel -->

        <LinearLayout
            android:id="@+id/slide_panel"
            android:layout_width="280dp"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:orientation="vertical" >

            <ListView
             android:id="@+id/list"
             android:layout_width="match_parent"
             android:layout_height="wrap_content">
            </ListView>             
        </LinearLayout>       

        <fragment
            android:id="@+id/map"
            android:name="com.google.android.gms.maps.SupportMapFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />


    </com.regulus.client.android.controls.SlidingPaneLayoutTouchOff>

</LinearLayout>

SlidingPaneLayoutTouchOff自定义类。扩展了SlidingPaneLayout。

1个回答

0

对于你来说,现在使用这个可能有点晚了,但它可能会帮助到其他人。

如果你想让顶部面板不完全关闭,你需要使用这个代码添加一些边距:android:layout_marginStart="50dp"

所以完整的xml代码应该是这样的:

 <android.support.v4.widget.SlidingPaneLayout
        android:id="@+id/sliding_pane"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <TextView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="#fff"
          android:text="bottom panel"/> 
    <TextView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_marginLeft="50dp"
          android:background="#f00"
          android:text="top panel"/>
</android.support.v4.widget.SlidingPaneLayout>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接