我想显示警报对话框设备的屏幕大小。我通过这个链接得到了解决方案How to make an alert dialog fill 90% of screen size?我使用给定的解决方案,它工作得很好,但我的警报消息显示的尺寸非常小。我们甚至无法在横向方向上发布信息。我已经使用了下面的代码。警报消息未显示在警报对话框中?
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.app_description).setPositiveButton(
"Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
builder.Title(title);
Dialog d = builder.setView(new View(this)).create();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(d.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.FILL_PARENT;
lp.height = WindowManager.LayoutParams.FILL_PARENT;
d.show();
d.getWindow().setAttributes(lp);
如何设置消息,以便它能正确显示在对话窗口中?
在此先感谢 普什帕
它在我的手机中占据了近90%的份额。你打给谁的警报对话框的父母是什么? 。 – Niranjan
确定按钮是正确的,即它位于窗口的底部。唯一的事情是我没有得到建设者类的消息。 – pushpa