public void show() { alertDialog = new Dialog(mContext, R.style.shareDialog); alertDialog.setContentView( mView, new LayoutParams( AppUtil.getWidth(mContext) - AppUtil.dip2px(mContext, 20), AppUtil.getHeight(mContext) - AppUtil.dip2px(mContext, 80))); alertDialog.getWindow().setGravity(Gravity.CENTER); alertDialog.getWindow().setBackgroundDrawableResource(R.drawable.qhq_alert_transparent_bg); alertDialog.setCanceledOnTouchOutside(true); alertDialog.show(); }
public void dismiss() { if (alertDialog != null) alertDialog.dismiss(); AppUtil.hideSoftInput(mContext, mView); }