Android Support Library 23.2
The Design Support Library provides implementations of many patterns of material design. This release allows developers to easily add bottom sheets to their app.
its very simple to added bottom sheet in your existing app. by doing some minor changes. Before go ahead update Android Support library to 23.2.0 using Android SDK.
and don't forgot to add compile 'com.android.support:design:23.2.0' as depandancy in your app level build.gradle file.
By attaching a BottomSheetBehavior to a child View of a CoordinatorLayout (i.e., addingapp:layout_behavior="android.support.design.widget.BottomSheetBehavior"), you’ll automatically get the appropriate touch detection to transition between five state:
- STATE_COLLAPSED: this collapsed state is the default and shows just a portion of the layout along the bottom. The height can be controlled with the app:behavior_peekHeight attribute (defaults to 0)
- STATE_DRAGGING: the intermediate state while the user is directly dragging the bottom sheet up or down
- STATE_SETTLING: that brief time between when the View is released and settling into its final position
- STATE_EXPANDED: the fully expanded state of the bottom sheet, where either the whole bottom sheet is visible (if its height is less than the containing CoordinatorLayout) or the entire CoordinatorLayout is filled
- STATE_HIDDEN: disabled by default (and enabled with the app:behavior_hideable attribute), enabling this allows users to swipe down on the bottom sheet to completely hide the bottom sheet
lets try sample here. do changes in existing layout like below
Bottom Sheet Layout
in your Activity add below code in OnCreate
I have Added full code in my Existing sample of Android design support on Github.