一个向上滑动的面板,就像具有中间状态的谷歌地图应用程序一样

Mar*_*ari 1 java android slideup

我想要谷歌地图应用程序为其业务页面提供的确切内容.

我在我的项目中使用SlidingUpPanel(lib).我有一个地图活动,我希望有一个像谷歌地图一样的滑动面板,我的滑动面板顶部有一个制作按钮. 这就是我要的

这是我的布局XML:

<com.sothree.slidinguppanel.SlidingUpPanelLayout
xmlns:sothree="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:id="@+id/SlidingPanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoPanelHeight="96dp"
sothree:umanoShadowHeight="4dp"
sothree:umanoAnchorPoint="0.7"
sothree:umanoParallaxOffset="100dp"
sothree:umanoOverlay="true">

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:minHeight="?attr/actionBarSize"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:titleTextColor="@android:color/white"
    app:layout_scrollFlags="scroll|enterAlways"
    android:background="?attr/colorPrimary">
</android.support.v7.widget.Toolbar>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/NestedScrollView">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <android.support.v7.widget.Toolbar
                android:id="@+id/SlidingPanelToolbar"
                android:minHeight="?attr/actionBarSize"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/colorPrimary">
            </android.support.v7.widget.Toolbar>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="@string/aaa"
                android:background="@android:color/white"/>

        </LinearLayout>

    </android.support.v4.widget.NestedScrollView>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

问题是这个上滑没有任何中间状态.它是向上还是关闭,但我也需要一个半开状态.

R. *_*ski 6

你需要的是BottomSheet UI模式.

它已在版本23.2中添加到Google的设计支持库

是一个如何使用它的示例教程.