DevStore首页 > DEV资源 > 源码下载 > 源码详情

Android版的SweetAlert,清新文艺,快意灵动的甜心弹框

 
pphdsny | 2014-11-15 10:34    浏览量(6966)    评论(47)    收藏(39)
功能分类:工具 支持平台:Android 运行环境:Android
开发语言:Java 开发工具:Android Studio 源码大小:958.90KB
下载源码 2143 人下载

源码简介

Android版的SweetAlert,清新文艺,快意灵动的甜心弹框,使用Eclipse导入即可!

源码截图

  • 效果图
DevStore所有源码来自用户上传分享,版权问题及牵扯到商业纠纷均与DevStore无关。

源码片段

只显示标题:

new SweetAlertDialog(this)
    .setTitleText("Here's a message!")
    .show();
显示标题和内容:

new SweetAlertDialog(this)
    .setTitleText("Here's a message!")
    .setContentText("It's pretty, isn't it?")
    .show();
显示异常样式:

new SweetAlertDialog(this, SweetAlertDialog.ERROR_TYPE)
    .setTitleText("Oops...")
    .setContentText("Something went wrong!")
    .show();
显示警告样式:

new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE)
    .setTitleText("Are you sure?")
    .setContentText("Won't be able to recover this file!")
    .setConfirmText("Yes,delete it!")
    .show();
显示成功完成样式:

new SweetAlertDialog(this, SweetAlertDialog.SUCCESS_TYPE)
    .setTitleText("Good job!")
    .setContentText("You clicked the button!")
    .show();
自定义头部图像:

new SweetAlertDialog(this, SweetAlertDialog.CUSTOM_IMAGE_TYPE)
    .setTitleText("Sweet!")
    .setContentText("Here's a custom image.")
    .setCustomImage(R.drawable.custom_img)
    .show();
确认事件绑定:

new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE)
    .setTitleText("Are you sure?")
    .setContentText("Won't be able to recover this file!")
    .setConfirmText("Yes,delete it!")
    .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
        @Override
        public void onClick(SweetAlertDialog sDialog) {
            sDialog.dismiss();
        }
    }).show();
显示取消按钮及事件绑定:

new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE)
    .setTitleText("Are you sure?")
    .setContentText("Won't be able to recover this file!")
    .setCancelText("No,cancel plx!")
    .setConfirmText("Yes,delete it!")
    .showCancelButton(true)
    .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() {
        @Override
        public void onClick(SweetAlertDialog sDialog) {
            sDialog.dismiss();
        }
    }).show();
确认后切换对话框样式:

new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE)
    .setTitleText("Are you sure?")
    .setContentText("Won't be able to recover this file!")
    .setConfirmText("Yes,delete it!")
    .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
        @Override
        public void onClick(SweetAlertDialog sDialog) {
            sDialog
                .setTitleText("Deleted!")
                .setContentText("Your imaginary file has been deleted!")
                .setConfirmText("OK")
                .setConfirmClickListener(null)
                .changeAlertType(SweetAlertDialog.SUCCESS_TYPE);
        }
    }).show();
  •   赞(3) 赞 +1 赞(3) 已赞
  •   收藏(39) 收藏 +1 已收藏 取消
  •   下载(2143)
评论(47)
Skylake01

Skylake01 2016-12-24 17:08:27

这个不错,可以借鉴学习
回复(0) 赞(0) 赞(1)
FlyTMSky

FlyTMSky 2016-07-19 14:07:40

Store都木有人审核 看评论的吗 木有人测试的吗?唉,既然做了良心人,为啥不做到底呢
回复(0) 赞(0) 赞(1)
123de

123de 2016-03-02 13:09:13

下载下来学习学习
回复(0) 赞(0) 赞(1)
xuyingnan

xuyingnan 2015-11-17 17:36:19

效果不错,非常感谢,
回复(0) 赞(0) 赞(1)
孔梓旭

孔梓旭 2015-06-17 17:04:49

http://download.csdn.net/detail/kenneth95/8569033这个是eclispe的
回复(2) 赞(0) 赞(1)
 
  • 孔梓旭:
    回复@jack_chentao:怎么可能 ,是eclispe的吧
    回复2015-06-29 18:08:45
  • jack_chentao:
    回复@孔梓旭:还是studio的
    回复2015-06-25 16:06:05
  • 推荐
  • 审核
  • 收录
  • 获取活力值

源码上传作者

  • 30 能力值
  • 12 源码
  • 3 评测
  • 0 资料

热门源码