Dialog skinning with AppCompat-v7 22 results in ugly shadows on api < 21

前端 未结 5 1452
深忆病人
深忆病人 2020-12-29 22:31

I\'m using AppCompat to write a material design styled app. Since AppCompat does not affect dialogs, I\'m skinning the dialogs as such:

styles.xml:



        
5条回答
  •  遥遥无期
    2020-12-29 22:39

    I had the exact same problem with the new AppCompat 22 library when using android.support.v7.app.AlertDialog for all my AlertDialogs, but the extra background layers only affected ProgressDialogs.

    All my AlertDialogs when styled using my custom theme looked great, but the ProgressDialog's had the weird overlay on the background as described in the OP.

    An option I had was to set a specific style each time I constructed a ProgressBar, but I was looking for an application wide solution.

    With the help of these two links:

    How to Style AlertDialogs like a Pro and Joerg Richter Blog I was able to get rid of the extra layer drawn on < 21 ProgressDialogs.

    The issue I found was that on all versions the ProgressBar draws its background based on what is defined by default in "android:alertDialogStyle".

    So to get rid of the extra layer, I had to define my own styles and set them for "android:alertDialogStyle". In doing so, I'm also overriding the default layouts applied to ProgressDialogs.

    Here's my themes.xml:

    @style/MyAlertDialogTheme
    @style/MyAlertDialogTheme
    @style/MyAlertDialogStyles
    

    And my styles.xml:

    
    
    
    

提交回复
热议问题