[英]How can I force my Widgets to use a dark theme?
In my application, I used Theme.Holo.Light
to make the ActionBar look light and I am pretty pleased with the result. 在我的应用程序中,我使用
Theme.Holo.Light
使ActionBar看起来很亮,我对此结果感到非常满意。
The only problem is that all my widgets (EditText, Spinner, etc..) are acting like the background was white, while I set it a dark blue: 唯一的问题是我所有的小部件(EditText,Spinner等)的行为都像背景是白色的,而我将其设置为深蓝色:
Is there an easy way in the style.xml file where I can force everything to act like the theme was dark? 在style.xml文件中是否有一种简单的方法可以强制所有操作,使主题像黑暗的一样?
I know that I could theme the text color, background resources, etc.. But this would be a huge work. 我知道我可以为文本颜色,背景资源等设置主题。但这将是一项巨大的工作。
Thank a lot for any hint that could help me to achieve that easily. 非常感谢您提供任何可以帮助我轻松实现目标的提示。
Edit: what sounds the best solution, but not working: 编辑:听起来最好的解决方案,但不起作用:
<style name="AppBaseTheme" parent="@android:Theme.Holo">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
</style>
To solve this (the easy way) you should use Theme.Holo
. 要解决此问题(简便方法),应使用
Theme.Holo
。 And Change the actionbar to Theme.Holo.Light
. 并将操作栏更改为
Theme.Holo.Light
。
extend theme: 扩展主题:
<style name="MyTheme.Dark" parent="android:Theme.Holo.Light.ActionBar"></style>
use getActionBar().getThemedContext()
as the context for inflating your views. 使用
getActionBar().getThemedContext()
作为扩大视图的上下文。
You can use Holoeverywhere library to achieve your result. 您可以使用Holoeverywhere库来实现您的结果。
HoloEveryWhere 哪里都有
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.