CircularDialogs
1.2
CircularDialogs是自定义的Android对话框库,可提供有关成功,警告和错误等常见操作的用户反馈。您可以通过将依赖关系添加到Gradle文件中来轻松使用IT。它允许您仅使用几行代码进行精美的对话框。您可以从预定义的条目和退出动画中进行选择。您可以使用很多选项,如下所述:
在存储库结束时将其添加到root build.gradle中:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
添加依赖关系
dependencies {
compile 'com.github.hassanusman:CircularDialogs:1.2'
}
new CDialog(this).createAlert("You missed something",
CDConstants.WARNING, // Type of dialog
CDConstants.LARGE) // size of dialog
.setAnimation(CDConstants.SCALE_FROM_BOTTOM_TO_TOP) // Animation for enter/exit
.setDuration(2000) // in milliseconds
.setTextSize(CDConstants.LARGE_TEXT_SIZE) // CDConstants.LARGE_TEXT_SIZE, CDConstants.NORMAL_TEXT_SIZE
.show();
这是您可以用来使事物看起来与众不同的不同自定义。
用于动画
CDConstants.SCALE_FROM_BOTTOM_TO_TOP, CDConstants.SCALE_FROM_RIGHT_TO_LEFT,
// Bottom and top can be exchanged as well as right to left.
// Like scale you can also use SLIDE animation just replace SLIDE with SCALE.
CDConstants.SLIDE_FROM_BOTTOM_TO_TOP
文字大小
setTextSize(CDConstants.NORMAL_TEXT_SIZE | CDConstants.LARGE_TEXT_SIZE);
// NOTE: If you give any other value it won't work always use these two values only.
期间
您可以以毫秒为单位的持续时间。如果您不提供持续时间对话框,则在用户点击屏幕后将关闭。
.setDuration(2000) // in milliseconds
对话框类型
目前,仅支持三种类型的对话框。Succes,cdconstants.warning和cdconstants.error。请参见使用的最佳示例。
您可以根据需要使用自己的图标。这是这样的方式:
CDialog createAlert(String message,Bitmap icon,int alertType,int size); // using Bitmap
CDialog createAlert(String message,Drawable icon,int alertType,int size); // Using Drawable
// Everything will be same just parameters are changed.
...
Hassanusman