简体   繁体   English

材质对话框更改文本大小

[英]Material Dialog Change Text Sizes

I would like to customise the title, description and button font sizes for the material alert dialog made using MaterialAlertDialogBuilder using a custom style from the styles.xml file.我想使用来自styles.xml文件的自定义样式为使用MaterialAlertDialogBuilder制作的材料警报对话框自定义标题、描述和按钮字体大小。 However, I am not sure how to go about creating the style.但是,我不确定如何创建样式。 Can someone please help me out with that.有人可以帮我解决这个问题。 TIA TIA

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);
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM