Bottom Sheets
Bottom Sheets:
Bottom Sheet is an application where the section slips up from the base of the screen, which optimistically provides extra data or choices.
Commonly, it is used to show additional details, actions, or options in order not to overwhelm the main content or occupy the full screen on an Android application designed according to Material Design Guidelines.
Example:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".BottomSheetExample">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/textState"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="State"
android:textColor="@color/colorOrange"
android:textSize="30sp"
android:gravity="center"/>
<Button
android:id="@+id/b1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Expand"
android:textAllCaps="false"
android:textColor="@color/colorWhite"
android:background="@color/colorAccent"
android:gravity="center"
android:layout_marginTop="10dp"/>
<Button
android:id="@+id/b2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Collapse"
android:textAllCaps="false"
android:textColor="@color/colorWhite"
android:background="@color/colorAccent"
android:gravity="center"
android:layout_marginTop="10dp"/>
</LinearLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="@color/colorPrimaryDark"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
app:behavior_peekHeight="60dp"
app:behavior_hideable="true">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Hey! This is the bottom sheet\n\n where you can expand or collapse bottom sheet by touch events."
android:textSize="18sp"
android:padding="16dp"
android:textColor="@color/colorWhite"
/>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Output