Leo.Han Leo.Han - 3 months ago 15
Android Question

Android BottomSheetDialog can't show title even though I set a title

It's my very first time to use BottomSheetDialog,
the code is like this:

final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);

When I ran this code, the title didn't show.

Can you explain to me what happened to this code? Thank you ~


If you look into the source code of android.support.design.widget.BottomSheetDialog you will find, that inside it's constructor there is a line:

// We hide the title bar for any style configuration. Otherwise, there will be a gap
// above the bottom sheet when it is expanded.

which clearly states, that Bottom sheet will not have title (with reason). (As of support library version 23.4.0)

Suggestion: Make a title of the view inside the layout of bottom sheet.