We can implement BottomSheet design like a GoogleMap.
AOSP: BottomSheetBehavior.java
Layout Sample
We add the param app:layout_behavior="@string/bottom_sheet_behavior" in child view of CoordinatorLayout.
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/bottom_sheet_behavior"
app:behavior_peekHeight="240dp"
app:behavior_hideable="false"
android:background="@android:color/white">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="BottomSheet Sample"/>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
We cab add following params.- app:behavior_peekHeight
- BottomSheet minimum size
- app:behavior_hideable
- BottomSheet is hidden when scroll to bottom.

No comments:
Post a Comment