app直播源代码,android中几种常用的弹框
一、SweetAlertDialog弹框
使用该控件需要添加依赖:
implementation 'com.github.f0ris.sweetalert:library:1.5.1'
下面是具体用法:
new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE)
.setTitleText("提示")
.setContentText("是否退出系统")
.setConfirmText("确定")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sweetAlertDialog) {
sweetAlertDialog.cancel();
}
})
.setCancelText("取消")
.setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sweetAlertDialog) {
sweetAlertDialog.dismiss();
}
})
.show();
二、AlertDialog 弹框
AlertDialog alertDialog1 = new AlertDialog.Builder(AtlasActivity.this)
.setTitle("提示")//标题
.setMessage(obj)//内容
.setIcon(R.mipmap.logo)//图标
.setCancelable(false) //点击弹框外部不会消失
.setPositiveButton("确定",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
}
})
.setNegativeButton("关闭", new DialogInterface.OnClickListener() {//添加取消
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
}
})
.create();
alertDialog1.show();
以上就是 app直播源代码,android中几种常用的弹框,更多内容欢迎关注之后的文章
标签:SweetAlertDialog,sweetAlertDialog,app,弹框,new,源代码 From: https://www.cnblogs.com/yunbaomengnan/p/17754523.html