我正在使用适用于 Android 的 SweetAlert Dialog。
https://github.com/pedant/sweet-alert-dialog
在成功对话框中,我想删除 OK 按钮并更改其样式。请说明如何删除确定按钮。
我在点击按钮时调用方法
new SweetAlertDialog(this, SweetAlertDialog.SUCCESS_TYPE)
.setTitleText("Good job!")
.setContentText("You clicked the button!")
.show();
最佳答案
您可以使用简单的策略从sweet alert访问按钮
SweetAlertDialog alertDialog = new SweetAlertDialog(MainActivity.this,SweetAlertDialog.SUCCESS_TYPE);
alertDialog.setTitleText("Good job!");
alertDialog.setContentText("You clicked the button!");
alertDialog.show();
Button btn = (Button) alertDialog.findViewById(R.id.confirm_button);
btn.setBackgroundColor(ContextCompat.getColor(UserSignupActivity.this,R.color.colorPrimary));
访问后,您可以根据需要设置样式或隐藏按钮。
关于android - 更改 Sweet alert 中的按钮样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45854694/