Change Theme.Dialog to look like Theme.Light.Dialog in Android

后端 未结 3 530
臣服心动
臣服心动 2021-01-04 00:25

There is no Theme.Light.Dialog to use with the rest of my project that is using Theme.Light.

How can I change Theme.Dialog to

相关标签:
3条回答
  • 2021-01-04 01:15

    This is good, thanks! I just changed it a bit: when I run what you suggested, the entire screen is painted with the back color and the dialog does not look as it should (with the previous activity dimmed).

    So instead of using

    @android:windowBackground
    

    just use

    @android:background
    
    0 讨论(0)
  • 2021-01-04 01:23

    Looks like I got it working.

    <color name="black">#FF000000</color>
    <color name="whitegrey">#FFF2F2F2</color>
    
    <style name="dialog_light" parent="@android:style/Theme.Dialog">
        <item name="@android:windowBackground">@color/whitegrey</item>
        <item name="@android:textColor">@color/black</item>        
    </style>
    
    0 讨论(0)
  • 2021-01-04 01:24

    Further to the above, to avoid making up colors, I did this:

    <!-- Makes a "light" equivalent of Theme.Dialog -->
    <style name="dialog_light" parent="@android:style/Theme.Dialog">
        <item name="@android:background">@android:color/background_light</item>
        <item name="@android:textColor">@android:color/primary_text_light</item>    
    </style>
    
    0 讨论(0)
提交回复
热议问题