dialog = new AlertDialog.Builder(context).create(); dialog.show(); //配置显示大小,居中 View inflate = LayoutInflater.from(context).inflate(R.layout.dialog_per_call, null); dialog.setContentView(inflate); Window window = dialog.getWindow(); window.setGravity(Gravity.CENTER); WindowManager.LayoutParams params = window.getAttributes(); params.width= Util.getScreenWidth(context) *2/ 3; //getResources().getDisplayMetrics().widthPixels window.setAttributes(params); TextView tvPhone = (TextView) inflate.findViewById(R.id.tv_dialog_per_phone);
AlertDialog自定义布局
最新推荐文章于 2023-03-05 15:45:23 发布