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自定義佈局
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.