Rounded Bottom Sheet

Nikita Pustovoi
AndroidHub
Published in
2 min readJan 22, 2019

Okay, so we all have seen Google’s refreshed rounded bottom sheet

New design

In my option, it looks so much better compared to old boring squared looking bottom sheet

Twitter (old design)

So without further ado, let me show you how to get the same result

TL;DL

Step 1. Add the JitPack repository to your build file

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

Step 2. Add the dependency

Dependency is very lightweight, adds only 2 tiny sized classes

dependencies {
implementation 'com.github.Deishelon:RoundedBottomSheet:1.0.1'
}

All done :)

Let me show you how to use it

Library provides two classes: RoundedBottomSheetDialogFragment and RoundedBottomSheetDialog

Usage — DialogFragment

Simply extend RoundedBottomSheetDialogFragment, inflate your layout and show it

import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment

class MyRoundedBottomSheet: RoundedBottomSheetDialogFragment(){

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.dialog_2_my_rounded_bottom_sheet, container, false)
}
}

Usage — Dialog

Simply extend or create an instance of RoundedBottomSheetDialog , inflate your layout and show it

import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialog

val mBottomSheetDialog = RoundedBottomSheetDialog(context!!)
val sheetView = layoutInflater.inflate(R.layout.dialog_2_my_rounded_bottom_sheet, null)
mBottomSheetDialog.setContentView(sheetView)
mBottomSheetDialog.show()

And here’s result what you can achieve:

GitHub: https://github.com/Deishelon/RoundedBottomSheet

Feedback, Shares, Claps, Stars are more than welcome :)

--

--