文件名称:可在Android应用中使用的材料警报对话框
文件大小:15.71MB
文件格式:ZIP
更新时间:2024-04-26 10:11:16
android源码
作者TutorialsAndroid,源码KAlertDialog,AlertDialog for Android,一个美丽的材料警报对话框,可在Android应用中使用。屏幕截图注意新版本的15.4.19 requireAPINew版本不支持旧的Android版本。建立使用AlertDialog的最简单方法是将库添加为构建的依赖项。完整将其添加到存储库末尾的根build.gradle中:allprojects { repositories { ... maven { url 'https://jitpack.io' } } }添加依赖项:dependencies { implementation 'com.github.TutorialsAndroid:KAlertDialog:v15.4.19' }使用显示材料进度KAlertDialog pDialog = new KAlertDialog(this, KAlertDialog.PROGRESS_TYPE); pDialog.getProgressHelper().setBarColor(Color.parseColor("#A5DC86")); pDialog.setTitleText("Loading"); pDialog.setCancelable(false); pDialog.show();您可以使用物质进度方法通过KAlertDialog.getProgressHelper动态自定义进度条:resetCount()isSpinning()spin()stopSpinning()getProgress()setProgress(float progress)setInstantProgress(float progress)getCircleRadius()setCircleRadius(int circleRadius)getBarWidth()setBarWidth(int barWidth)getBarColor()setBarColor(int barColor)getRimWidth()setRimWidth(int rimWidth)getRimColor()setRimColor(int rimColor)getSpinSpeed()setSpinSpeed(float spinSpeed)基本信息:new KAlertDialog(this) .setTitleText("Here's a message!") .show();带有文字的标题:new KAlertDialog(this) .setTitleText("Here's a message!") .setContentText("It's pretty, isn't it?") .show();错误信息:new KAlertDialog(this, KAlertDialog.ERROR_TYPE) .setTitleText("Oops...") .setContentText("Something went wrong!") .show();警告信息:new KAlertDialog(this, KAlertDialog.WARNING_TYPE) .setTitleText("Are you sure?") .setContentText("Won't be able to recover this file!") .setConfirmText("Yes,delete it!") .show();成功信息:new KAlertDialog(this, KAlertDialog.SUCCESS_TYPE) .setTitleText("Good job!") .setContentText("You clicked the button!") .show();带有自定义图标的消息:new KAlertDialog(this, KAlertDialog.CUSTOM_IMAGE_TYPE) .setTitleText("Sweet!") .setContentText("Here's a custom image.") .setCustomImage(R.drawable.custom_img) .show();绑定监听器确认按钮:new KAlertDialog(this, KAlertDialog.WARNING_TYPE) .setTitleText("Ar