菜鸟报道———-简单的自定义dialog
AlertDialog.Builder builder = new AlertDialog.Builder(InterViewSurfaceNewActivty.this);
alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(false);//设置区域外点击消失
alertDialog.setCancelable(false);//设置返回键点击是否消失
alertDialog.show();//注意要先调用此方法,后面的设置才管用
alertDialog.getWindow().setLayout(500, 300);//(可以根据屏幕比例设置大小)
View view=LayoutInflater.from(this).inflate(R.layout.dialog_interview,
null);
TextView tvConfig = (TextView) view.findViewById(R.id.dialog_config);
tvConfig.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
alertDialog.dismiss();
finish();
return;
}
});
alertDialog.getWindow().setContentView(view);