材质对话框更改文本大小

时间:2019-04-22 12:00:34

标签: android material-design

我想使用MaterialAlertDialogBuilder文件中的自定义样式为使用styles.xml创建的物料警报对话框自定义标题,描述和按钮字体大小。但是,我不确定如何创建样式。有人可以帮我吗TIA

1 个答案:

答案 0 :(得分:0)

AlertDialog dialog = new MaterialAlertDialogBuilder(this)
                .setMessage(description)
                .setCancelable(false)
                .setPositiveButton(R.string.ok, null)
                .create();

        dialog.show();

        dialog.getButton(Dialog.BUTTON_POSITIVE).setTextSize(18);

        TextView textView = dialog.findViewById(android.R.id.message);
        if (textView != null) {
            textView.setTextSize(18);
        }