这是简单的写法,这样就是用原生的属性
原生的属性有几点不好:
(1)你不能通过代码修改背景,只能在xml中自己画一个背景来覆盖他。
原生的属性有几点不好:
(1)你不能通过代码修改背景,只能在xml中自己画一个背景来覆盖他。
(2)一直有一个黑色的框框
AlertDialog.Builder builder = new AlertDialog.Builder(this);
View dialogView = View.inflate(this,R.layout.dialog_psw, null);// 自定义Dialog的布局builder.setView(dialogView);builder.setCancelable(false);// 创建dialog对象,用于让对话框消失
final AlertDialog dialog = builder.create();
dialog.show();然后获取控件,设置bottom事件就可以了,可以用dialog.miss来使对话框消失
3、builder.setCancleavle(false);让屏幕只能点击对话框的按钮
4、自定义的对话框尽量别用builder.show(),用dialog.show().