Skip to content

8 Creating and showing the bottom sheet

Michael Rapp edited this page Dec 30, 2017 · 1 revision

Once an instance of the class BottomSheet.Builder has been configured by using the setter methods discussed in the previous sections of this documentation, the builder's method create():BottomSheet can be used to create the bottom sheet as an instance of the class BottomSheet. Such an instance can be shown by calling its show-method.

A shorter way of showing the bottom sheet, which is created by a BottomSheet.Builder, is to call the builder's show-method. This method implicitly calls the create-method to create the bottom sheet, as well as the bottom sheet's show-method to show the bottom sheet on the screen.

After a BottomSheet has been shown using its show-method, some of its attributes can still be changed. The class therefore provides a subset of the methods, which are also provided by the builder. Additionaly getter methods, which allow to retrieve a bottom sheet's attributes, are also provided. By default, if the content of a bottom sheet extends a specific height, it is shown in a minimized way, which causes only a few of its item to be visible. By dragging the bottom sheet, it can be expanded to display the whole content. If the a bottom sheet should be maximized by default, the maximize-method of the BottomSheet or BottomSheet.Builder instance can be used instead of the show-method.