private Dialog alertDialog = new AlertDialog.Builder(context).
setView(view).
create();
alertDialog.getWindow().setDimAmount(0f);//设置透明背景
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable());//设置背景填充
alertDialog.getWindow().setGravity(Gravity.LEFT | Gravity.BOTTOM);//设置位置
alertDialog.setCancelable(false);//设置点击返回键dialog不消失
alertDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);//FLAG_LAYOUT_NO_LIMITS设置窗口可以点击下面的界面,FLAG_LAYOUT_NO_LIMITS设置可以移到窗口之外
原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/272852.html