我正在使用必须在整个屏幕上显示的警报对话框,并且高度不会取决于文本的长度。但是我在显示文本时遇到了问题。我正在使用以下代码:
AlertDialog.Builder adb = new AlertDialog.Builder(getParent());
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.width = WindowManager.LayoutParams.FILL_PARENT;
lp.height = WindowManager.LayoutParams.FILL_PARENT;
adb.setTitle("Alert");
adb.setCancelable(true);
adb.setNeutralButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton){
}
});
adb.setMessage(ConfigClass.MSG_USER_INFO_EMPOWEREDON);
Dialog d = adb.setView(new View(this)).create();
lp.copyFrom(d.getWindow().getAttributes());
d.getWindow().setAttributes(lp);
d.show();
请让我知道我错过了什么。