-
Notifications
You must be signed in to change notification settings - Fork 32
7 Using custom views
If the bottom sheet, which is created by a BottomSheet.Builder
should be used to display a custom view, the following methods can be used to replace the bottom sheet's default content.
setCustomTitle(View):Builder
setView(int):Builder
setView(View):Builder
The setCustomTitle
-method causes the child view, which is used to show the bottom sheet's title and icon, to be replaced by a specific custom view. If the custom view contains a TextView
with the id android.R.id.title
, the bottom sheet's title will be shown by using this view. Otherwise, the bottom sheet's title will not be shown and the custom view can be used for any other purpose. When the setView
methods are used to specify a custom content view by passing the view itself or the resource id of the appropriate layout resource, the GridView
, which is used to show the bottom sheet's list items, will be replaced. If the custom view contains a GridView
with the id R.id.bottom_sheet_grid_view, this view will be used to show the bottom sheet's items. Otherwise, the items cannot be shown.