将 Theme.Dialog 更改为 Android 中的 Theme.Light.Dialog [英] Change Theme.Dialog to look like Theme.Light.Dialog in Android

查看:20
本文介绍了将 Theme.Dialog 更改为 Android 中的 Theme.Light.Dialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有 Theme.Light.Dialog 可用于我正在使用 Theme.Light 的项目的其余部分.

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

如何将 Theme.Dialog 更改为类似于 DialogTheme.Light 版本.

How can I change Theme.Dialog to look like a Theme.Light version of Dialog.

我知道我必须覆盖 style.xml 中的 Theme.Dialog 部分,如下所示.我应该用哪些值覆盖哪些项目?

I know that I must overwrite sections of Theme.Dialog in styles.xml as below. What items should I overwrite with which values?

<style name="dialog_light" parent="@android:style/Theme.Dialog">
    <item name="android:???????"></item>
    <item name="android:???????"></item>
</style>

我可以将背景设为浅白色灰色,但按钮、微调器等在浅色主题上也有所不同,以便在浅色背景上看起来更好.

I could just make the background that light white grey, but the buttons, spinners etc are also different on the light theme to look better on the light background.

编辑

看起来我已经成功了.

<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>

推荐答案

看来我搞定了.

<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>

这篇关于将 Theme.Dialog 更改为 Android 中的 Theme.Light.Dialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆