/ Dialogs

Another BottomSheetDialog for Android

Another BottomSheetDialog for Android


Another BottomSheetDialog for Android.


Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
    repositories {
        maven { url "https://jitpack.io" }


Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
    implementation 'com.github.invissvenska:ModalBottomSheetDialog:VERSION'


Implement the ModalBottomSheetDialog Listener interface on your Activity or Fragment:

public class MainActivity extends AppCompatActivity implements ModalBottomSheetDialog.Listener {
    // some other code

    public void onItemSelected(String tag, Item item) {
        Toast.makeText(getApplicationContext(), "Tag: " + tag + ", clicked on: " + item.getTitle(), 
new ModalBottomSheetDialog.Builder()
    .setHeader(String title) // optional
    .setHeaderLayout(@LayoutRes int layoutResource) // optional (TextView must have id 'header' in layout)
    .add(@MenuRes int menuResource) // can be used more then once
    .setItemLayout(@LayoutRes int layoutResource) // optional (TextView with id 'title' or ImageView with id 'icon' must be defined in layout)
    .setColumns(int columns) // optional (default is 1)
    .setRoundedModal(boolean roundedModal) // optional (default is false)
    .show(FragmentManager fragmentManager, String tag);

Extend you theme with on of the DayNight variants to support a dark styled ModalBottomSheetDialog. For example styles.xml:

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>

    <!-- other style declarations -->



To create a ModalBottomSheetDialog and display it later in code:

ModalBottomSheetDialog dialog = new ModalBottomSheetDialog.Builder()
    .setHeader("Title of modal")
// some other code in between
dialog.show(getSupportFragmentManager(), "WithHeader");

To display a ModalBottomSheetDialog directly:

new ModalBottomSheetDialog.Builder()
    .setHeader("Title of modal")
    .show(getSupportFragmentManager(), "WithHeader");

To display a ModalBottomSheetDialog with items from multiple menu resources:

new ModalBottomSheetDialog.Builder()
    .show(getSupportFragmentManager(), "WithoutHeader");

To display a ModalBottomSheetDialog in a grid layout:

new ModalBottomSheetDialog.Builder()
    .setHeader("Grid bottom layout")
    .show(getSupportFragmentManager(), "Grid Layout");

To display a ModalBottomSheetDialog with custom layout:

new ModalBottomSheetDialog.Builder()
    .setHeader("Custom title and item layouts")
    .show(getSupportFragmentManager(), "Custom Layout");

To display a ModalBottomSheetDialog with rounded corners:

new ModalBottomSheetDialog.Builder()
    .setHeader("Rounded bottom layout")
    .show(getSupportFragmentManager(), "Rounded Layout");