我正在使用一个具有多个复选框的警报对话框。如何更改复选框列表元素的文本大小? (我可以更改标题和按钮的大小)

boolean[] allBoolean = {true, true, true, true, true, true, true, true};

AlertDialog.Builder prompt = new AlertDialog.Builder(Class.this);
prompt.setTitle("Title");
prompt.setMultiChoiceItems(all, allBoolean, new DialogInterface.OnMultiChoiceClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which, boolean isChecked) {
        allBoolean[which] = isChecked;
    }
});
prompt.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
        //do nothing
    }
});
prompt.setPositiveButton("Select", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
        //do something
    }
});

最佳答案

alertDialog.show();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();

lp.copyFrom(alertDialog.getWindow().getAttributes());
lp.width = 150;
lp.height = 500;
lp.x=-170;
lp.y=100;
alertDialog.getWindow().setAttributes(lp);

10-07 19:20
查看更多