开源软件名称(OpenSource Name):marcoscgdev/DialogSheet开源软件地址(OpenSource Url):https://github.com/marcoscgdev/DialogSheet开源编程语言(OpenSource Language):Kotlin 100.0%开源软件介绍(OpenSource Introduction):DialogSheetAn Android library to create fully material designed bottom dialogs similar to the Android Pay app. Releases:Current release: 2.1.2.
You can see all the library releases here. ScreenshotsDownload the sample apk here. Usage:Adding the depencencyAdd this to your root build.gradle file: allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
} Now add the dependency to your app build.gradle file: implementation 'com.github.marcoscgdev:DialogSheet:2.1.2' Creating the dialogHere is a complete snippet of it usage: val dialogSheet = DialogSheet(this)
.setTitle(R.string.app_name)
.setMessage(R.string.lorem)
.setColoredNavigationBar(true)
.setTitleTextSize(20) // In SP
.setCancelable(false)
.setPositiveButton(android.R.string.ok) {
// Your action
}
.setNegativeButton(android.R.string.cancel) {
// Your action
}
.setNeutralButton("Neutral")
.setRoundedCorners(false) // Default value is true
.setBackgroundColor(Color.BLACK) // Your custom background color
.setButtonsColorRes(R.color.colorAccent) // You can use dialogSheetAccent style attribute instead
.setNeutralButtonColor(Color.WHITE)
.show() Creating the dialog using the new styleSimply use the new DialogSheet2 class: val dialogSheet = DialogSheet2(this)
...
...
.show() Or add a new boolean-type argument to the dialog constructor: val dialogSheet = DialogSheet2(this, true)
...
...
.show() Colorize buttonsYou can do it programmatically .setButtonsColorRes(R.color.colorPrimary) .setPositiveButtonColorRes(R.color.colorPrimary)
.setNegativeButtonColorRes(R.color.colorNegative)
.setNeutralButtonColorRes(R.color.colorNeutral) Or by adding this atribute to your main app theme <item name="dialogSheetAccent">@color/colorAccent</item> Customize corner radiusSimply override this dimen with your desired size <dimen name="dialog_sheet_corner_radius">16dp</dimen> Adding a custom view:
val view = View.inflate(context, R.layout.custom_dialog_view, null)
dialogSheet.setView(view)
dialogSheet.setView(R.layout.custom_dialog_view)
// Access dialog custom inflated view
val inflatedView = dialogSheet.getInflatedView()
val button = inflatedView.findViewById(R.id.customButton)
... Custom resources:Override it if you want :P <dimen name="dialog_sheet_corner_radius">16dp</dimen>
<dimen name="dialog_sheet_icon_size">56dp</dimen>
<dimen name="dialog_sheet_v2_icon_size">60dp</dimen>
<dimen name="dialog_sheet_button_text_size">15sp</dimen>
License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论