Reducing font size of AlertDialog.Builder's components

前端 未结 4 612
不思量自难忘°
不思量自难忘° 2020-12-10 03:11

I created an AlertDialogue using the following code :

 int selectedModeId=0;
 public void sortTypeModeSelection(){

    AlertDialog.Builder aler         


        
4条回答
  •  我在风中等你
    2020-12-10 04:05

    I was able to achieve this through styles. I added this style to my styles.xml file in the values directory:

    
    

    Then when creating the AlertDialog, I wrapped the activity context in a ContextThemeWrapper and passed that into the Builder constructor:

    ContextThemeWrapper cw = new ContextThemeWrapper( this, R.style.AlertDialogTheme );
    AlertDialog.Builder b = new AlertDialog.Builder( cw );
    

    This produced smaller text size for the list items in the dialog.

    enter image description here

提交回复
热议问题