简体   繁体   中英

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. However, I am not sure how to go about creating the style. Can someone please help me out with that. 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);
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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