【问题标题】:Android. Sliding Panel not fully closed安卓。滑动面板未完全关闭
【发布时间】:2015-05-20 04:26:22
【问题描述】:

我需要Sliding Panel在关闭状态下没有完全关闭。

(例如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

【问题讨论】:

    标签: android slidingpanelayout


    【解决方案1】:

    这对你有帮助已经很晚了,但它可能会帮助其他人。

    如果您希望顶部面板不完全关闭,您需要使用 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>
    

    【讨论】:

      猜你喜欢
      • 2011-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-18
      • 1970-01-01
      • 2011-10-04
      • 2011-12-20
      相关资源
      最近更新 更多