如果我将空数组传递给setItems
,则AlertDialog
会在运行Android 9的模拟器上全屏显示。但是,在运行Android 5.1的设备上,它不会全屏显示,这是我试图实现的行为。
是什么原因导致AlertDialog
在运行Android 9的模拟器上全屏显示,而不是在运行Android 5.1的设备上全屏显示?
这就是我设置AlertDialog
的方式:
AlertDialog.Builder builder = new AlertDialog.Builder(ContextActivity);
builder.setTitle(dialogTitel);
builder.setItems(arrayItems, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int item) {
...
}
});
final AlertDialog Block = builder.create();
Block.show();
它在模拟器上:
编辑:这是在运行Android 5.1的设备上的外观。
答案 0 :(得分:0)
在下面使用所需的宽度和高度设置
Block.Show().Window.SetLayout(some_width,some_height);