将 Theme.Dialog 更改为 Android 中的 Theme.Light.Dialog

Change Theme.Dialog to look like Theme.Light.Dialog in Android(将 Theme.Dialog 更改为 Android 中的 Theme.Light.Dialog)
本文介绍了将 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How To Create a Rotating Wheel Control?(如何创建转轮控件?)
How to avoid restarting activity when orientation changes on Android(如何在 Android 上的方向更改时避免重新启动活动)
Screen orientation lock(屏幕方向锁定)
Strange behavior with android orientation sensor(android方向传感器的奇怪行为)
Android: Rotate image in imageview by an angle(Android:将imageview中的图像旋转一个角度)
Activity restart on rotation Android(旋转Android上的活动重启)