Bottom sheet with rounded corners
Rounded Bottom Sheet - Android
|
|
| | ------------- |:-------------:|
Install
Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.Deishelon:RoundedBottomSheet:1.0.1'
}
Usage - DialogFragment
Simply extend RoundedBottomSheetDialogFragment, inflate your layout and show it
Example
import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment
class MyRoundedBottomSheet: RoundedBottomSheetDialogFragment(){
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.dialog2myroundedbottom_sheet, container, false) } }
Usage - Dialog
Simply extend or create an instance of RoundedBottomSheetDialog , inflate your layout and show it
Example
import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialog
val mBottomSheetDialog = RoundedBottomSheetDialog(context!!) val sheetView = layoutInflater.inflate(R.layout.dialog2myroundedbottom_sheet, null) mBottomSheetDialog.setContentView(sheetView) mBottomSheetDialog.show()
Customization
We provide a few options to customize, to make sure your Bottom Sheet will feel native to your app To change default values, just override the recourse you wish, like so:
<color name="roundedBottomSheetPrimaryBackground">#F06292</color>
| Recourse | Description | Default value | | ------------- | ------------- | ------------- | | @color/roundedBottomSheetPrimaryBackground | Background colour | #FFFFFFFF | | @color/roundedBottomSheetPrimaryNavigationBarColor | Navigation bar colour | #FFFFFFFF | | @dimen/roundedBottomSheetCornerRadius | Bottom sheet corner radius | 16dp | | @dimen/roundedBottomSheetCornerRadiusTopPadding | Top padding | 8dp | | @dimen/roundedBottomSheetCornerRadiusLeftPadding | Left padding | 8dp | | @dimen/roundedBottomSheetCornerRadiusRightPadding | Right padding | 8dp |