其实代码就这么几行,研究的时候需要花费较多时间。注意这里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();