Custom dialog too small

后端 未结 11 2473
轻奢々
轻奢々 2020-12-10 10:53

I have an android activity that implements a custom dialog.The application is running ok but the dialog is too small,i want to display a bigger dialog.How can i achieve this

11条回答
  •  感动是毒
    2020-12-10 11:39

    I configured my project so that the default dialog theme for DialogFragments has a minimum width.

    set the app's theme to your custom theme in the AndroidManifest.xml....alternatively, set the theme of the Activity hosting the DialogFragment to your app's custom theme.

    
    
    
             
    
            .....
    
        
    
    
    

    define your custom theme in values/styles.xml, and override the default theme used for dialog fragments with one you define yourself.

    
    
    
        
    
        
        
    
        .....
    
    
    

    if you use a dark theme, and overrode android:windowBackground like i did in AppTheme.Dialog, then add a drawable/dialog__window_background.xml file with the contents:

    
    
        
            
            
        
    
    

提交回复
热议问题