Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android "Top Sheet" equivalent of "Bottom Sheet"?

I am wanting to implement a "Bottom Sheet" type of layout, but with a twist where the "bottom" sheet will be a MapFragment, which won't work very well as an up/down draggable view.

I had a probably naive thought to "flip" the logic to a "Top Sheet" design, where you drag the Top Sheet up/down to show more/less of the bottom MapFragment.

ie: From this...
Bottom Sheet Example

...to [something like] this...
Top Sheet Example

Is this possible given the Support Design Tools, or will I have to roll something like this on my own?

like image 866
swooby Avatar asked Aug 22 '16 20:08

swooby


1 Answers

I found a TopSheetBehavior implementation and have tried to keep it up-to-date: https://github.com/carlos-mg89/TopSheetBehavior

It has proved to work pretty well in my case. I found many other TopSheetBehavior that were incomplete or that crashed, but this one doesn't crash and works out of the box by only replacing the behavior parameter:

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:behavior_hideable="true"
        app:behavior_peekHeight="56dp"
        app:layout_behavior="your.package.components.TopSheetBehavior">

        <!-- Your content goes here -->

    </LinearLayout>
like image 51
xarlymg89 Avatar answered Oct 13 '22 01:10

xarlymg89