MaterialStyledDialogs - 基于Material帶頭部的Android對話框
MaterialStyledDialogs - 一個Android庫用于創建一個漂亮和可定制基于Material帶頭部的對話框。基于 material-dialogs 并且受到 dribbble 啟發
How to include
Add the repository to your project build.gradle:
repositories {
maven {
url "https://jitpack.io"
}
}
And add the library to your module build.gradle:
dependencies {
compile 'com.github.javiersantos:MaterialStyledDialogs:1.2'
}
Usage
Basic Dialog
A basic dialog will show the provided title (optional) and description, using your primary color as the header background.
new MaterialStyledDialog(this)
.setTitle("Awesome!")
.setDescription("What can we improve? Your feedback is always welcome.")
.show();
or using the builder...
MaterialStyledDialog dialog = new MaterialStyledDialog(this)
.setTitle("Awesome!")
.setDescription("What can we improve? Your feedback is always welcome.")
.build();
...
dialog.show();
Customization
// Set an icon for the dialog header.
.setIcon(R.drawable.ic_launcher)
// Set if the header icon will be displayed with an initial animation.
// Default: true
.withIconAnimation(false)
// Set if the dialog will be displayed with an open and close animation, with custom duration.
// Default: false
.withDialogAnimation(true)
// Default: false, Duration.NORMAL
.withDialogAnimation(true, Duration.SLOW)
// Set a color for the dialog header.
// Default: Theme primary color.
.setHeaderColor(R.color.dialog_header)
// Set an image for the dialog header.
// API 16+ required.
.setHeaderDrawable(R.drawable.header)
// Set if the dialog will be hidden when touching outside.
// Default: true
.setCancelable(false)
// Set if the description will be scrollable, with custom maximum lines.
// Default: false
.setScrollable(true)
// Default: false, 5
.setScrollable(true, 10)
// Set a positive, negative and/or neutral button for the dialog.
.setPositive(getResources().getString(R.string.button), new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(MaterialDialog dialog, DialogAction which) {
Log.d("MaterialStyledDialogs", "Do something!");
}
})
//.setNegative(...)
//.setNeutral(...)
Apps already using this library
![]() |
項目地址: https://github.com/javiersantos/MaterialStyledDialogs
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!