android - Material 对话框更改文本大小

标签 android material-design

我想使用 styles.xml 文件中的自定义样式自定义使用 MaterialAlertDialogBu​​ilder 创建的 Material 警报对话框的标题、描述和按钮字体大小。但是,我不确定如何去创建这种风格。有人可以帮我解决这个问题吗? 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);
        }

关于android - Material 对话框更改文本大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55794090/

相关文章:

android - 如何在不重复的情况下更改 MaterialButton 的样式?

javascript - MD 波纹按钮无法打开链接

android - 如果按下一个按钮执行某些操作,则按下其他按钮应该执行其他操作

android - PhoneGap 未在 Android 中运行

android - AudioRecord:AudioFormat常量和麦克风选择

css - 圆形 Material Icons 边框和颜色问题

android - 添加部分时,如何在 NavigationView 的抽屉菜单中保持单个 checkableBehavior 模式?

Android - Logcat 不显示日志 Activity

java - 使用 JRE 1.8 或更高版本运行 Android Studio

css - Material Icons 有时无法在移动网络浏览器上加载