android – 将应用程序主题textColor设置为白色原因上下文菜单项文本为白色(不可见)

好的,这是驱使我笨蛋.要皮肤我的应用程序,我设置以下在我的主题
<item name="android:textColor">#FFFFFF</item>

应用程序中的所有文本都将变为白色,除非我在布局xmls中手动覆盖它.太好了除了我的菜单选项中的文本(从列表和其他列表等)还决定变为白色.

这不是很好,因为白色白色很难读.我已经尝试了各种解决方案,包括搜索如何更改上下文菜单(无骰子)的文本颜色,并在我的主题中创建一个textAppearance项目.最后一个解决方案没有改变我的应用程序中的所有文本框,这是令人沮丧的.

那么,有什么建议吗?希望我的爱人很清楚.

解决方法

在您的styles.xml中,尝试覆盖textViewStyle,而不是只有所有textColor属性
<style name="Theme.Blundell.Light" parent="@android:style/Theme.NoTitleBar">
    <item name="android:windowBackground">@drawable/background_light</item>
    <item name="android:textViewStyle">@style/Widget.TextView.Black</item>
</style>

<style name="Widget.TextView.Black" parent="@android:style/Widget.TextView">
    <item name="android:textColor">#000000</item>
</style>

您甚至可以再进一步,只是覆盖某个视图的颜色,如按钮:

<style name="Widget.Holo.Button" parent="@android:style/Widget.Holo.Button">
    <item name="android:textColor">#FFFFFF</item>
</style>

<style name="Theme.Blundell" parent="@android:style/Theme.Holo.NoActionBar">
    <item name="android:colorBackground">@android:color/transparent</item>
    <item name="android:buttonStyle">@style/Widget.Holo.Button</item>
</style>

如果您启发了更多的主题,请查看Android源代码,这是了解您可以做什么的最佳方式!

https://github.com/android/platform_frameworks_base/tree/master/core/res/res/values

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...