javaandroidslideup

a sliding up panel just like google maps app that have a middle state


I want the Exact thing that Google Map app has for its business pages.

I'm using SlidingUpPanel (lib) in my project. I have a map activity and I want to have a sliding up panel like google map with a fab button on top of my sliding panel. this is what i want

This is my layout 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>

The problem is that this slide up doesn't have any middle state. it is either up or closed but I need a half-open state too.


Solution

  • What you need is a BottomSheet UI pattern.

    It was added to the Google's Design Support Library in version 23.2

    Here is a sample tutorial on how to use it.