现在的位置: 首页 > 综合 > 正文

Android AlertDialog去掉系统黑色背景

2013年12月07日 ⁄ 综合 ⁄ 共 284字 ⁄ 字号 评论关闭

其实代码就这么几行,研究的时候需要花费较多时间。注意这里new的一定是Dialog不是它的子类,然后它的背景设置为透明就可以了

				Dialog dialog=new Dialog(this);
				AlertCustom custom=new AlertCustom();
				dialog.setContentView(custom.getView());
				dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
				custom.setDialog(dialog);
				dialog.show();

抱歉!评论已关闭.