Difference Between Modal and Persistent Bottom Sheet in Android
Android BottomSheet is a kind of view that is used as supplementary surfaces in mobile apps. This component is a part of the android design support library and is used to expose more data or information, menus, deep linked content, and in place of dialogs. It appears on the screen by sliding up from the bottom of the application screen and the user can hide it after receiving the information. One can easily notice BottomSheets in applications like Google Maps, music players, etc. In modern Android applications, BottomSheets are of two types:
- Persistent BottomSheet
- Modal BottomSheet
Persistent BottomSheet displays the Android bottom sheet just like any other View present on the activity/fragment layout. As the name suggests, its presence is persistent i.e., it co-exists with the application main UI region. It facilitates users by displaying relevant app content and allow interaction in that region simultaneously. Developers use this BottomSheet to display menus, any kind of secondary content, or other supporting content for the application.
Persistent BottomSheet in Google Maps:
This kind of BottomSheet has an appearance similar to an alert-dialog or dialog fragment. The name has been given because of its behavior and appearance that are similar to Modals. Unlike Persistent BottomSheet, it appears from the bottom of the screen when a user requests certain actions. When activated, it shadows the activity/fragment of the main application. The sheet contents have a higher elevation than the app(16dp by default) and it includes a list of options corresponding to the action request made by the user or deep-linked content from other applications.
Modal BottomSheet in Google Drive(appears on clicking the “+” icon for adding new items into the drive):
|Display content related to the application or current activity.||Display content of other applications that are interlinked with the current app.|
|Always present at bottom of the app screen and display some content. When activated/clicked, it shows complete information.||Appear on the screen when a user clicks on certain action buttons. While poping up on the screen, it replaces the already present menu or dialogs.|
|It is a part of the activity view layout.||It is not a part of an activity view layout but appears dynamically when the user demands.|
|Integrated into the app in order to display supporting content.||Slides up from the bottom of the screen when needed.|
|The elevation of its appearance is the same as that of the application’s content.||Its appearance has a higher elevation than the application’s content. Android dims and blocks the interaction with the main app to shift the focus of the user.|
|BottomSheetBehavior(a kind of layout_behavior) is applied to a child of CoordinatorLayout in order to make it a Persistent bottom sheet.||To make a bottom sheet of Modal design, BottomSheetDialogFragment is used on top of the Fragment support library. It renders the fragment acting as a dialog to a Modal bottom sheet.|
|To see more or less content, it can be dragged upward or downward respectively.||Expose its content by dragging it vertically upwards. Tap the content outside the dialog to dismiss the bottom sheet.|
|To control its appearance, certain kinds of states are present such as STATE_COLLAPSED, STATE_EXPANDED, STATE_DRAGGING, STATE_SETTLING, and STATE_HIDDEN.||No such states are present in it as the appearance is similar to an alert-dialog or dialog fragment.|