Changing font size into an AlertDialog

后端 未结 7 2242
广开言路
广开言路 2020-12-04 22:10

I am trying to put some loooong text into an AlertDialog. The only issue the default font size that is really too big, so I want to make it smaller.

Here are all the

7条回答
  •  被撕碎了的回忆
    2020-12-04 22:32

    For Buttons:

      final AlertDialog ad = new AlertDialog.Builder(mainScreen)
    .setPositiveButton("OK", null) 
    .setNegativeButton("Cancel", null).create();
    
    ad.setOnShowListener(new DialogInterface.OnShowListener() {
                                                @Override
                                                public void onShow(DialogInterface dialog) {
                                                    int textSize = (int) Helper.getDimen(mainScreen, R.dimen.textSize12);
                                                    ad.getButton(Dialog.BUTTON_POSITIVE).setTextSize(textSize);
                                                    ad.getButton(Dialog.BUTTON_NEGATIVE).setTextSize(textSize);
                                                }
    
    
                                          });
    
    ad.show();
    

提交回复
热议问题