2.1.x
This example depends on Support Library 23.4.0.+.
BottomSheetBehavior is characterized by :
Two toolbars with animations that respond to the bottom sheet movements.
A FAB that hides when it is near to the "modal toolbar" (the one that appears when you are sliding up).
A backdr...
Make sure the following dependency is added to your app's build.gradle file under dependencies:
compile 'com.android.support:design:25.3.1'
Then you can use the Bottom sheet using these options:
BottomSheetBehavior to be used with CoordinatorLayout
BottomSheetDialog which is a dialog with a ...
You can achieve a Persistent Bottom Sheet attaching a BottomSheetBehavior to a child View of a CoordinatorLayout:
<android.support.design.widget.CoordinatorLayout >
<!-- ..... -->
<LinearLayout
android:id="@+id/bottom_sheet"
android:elevation...
You can realize a modal bottom sheets using a BottomSheetDialogFragment.
The BottomSheetDialogFragment is a modal bottom sheet.
This is a version of DialogFragment that shows a bottom sheet using BottomSheetDialog instead of a floating dialog.
Just define the fragment:
public class MyBottomSheet...
The BottomSheetDialog is a dialog styled as a bottom sheet
Just use:
//Create a new BottomSheetDialog
BottomSheetDialog dialog = new BottomSheetDialog(context);
//Inflate the layout R.layout.my_dialog_layout
dialog.setContentView(R.layout.my_dialog_layout);
//Show the dialog
dialog.show();
...
BottomSheet DialogFragment opens up in STATE_COLLAPSED by default. Which can be forced to open to STATE_EXPANDEDand take up the full device screen with help of the following code template.
@NonNull @Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
BottomSheetDialog dialog = ...