Pok*_*oko 11 android themes contextmenu textcolor
好吧,这让我疯狂.为我的应用程序设置皮肤,我在主题中设置了以下内容:
<item name="android:textColor">#FFFFFF</item>
Run Code Online (Sandbox Code Playgroud)
应用程序中的所有文本都变为白色,除非我在布局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>
Run Code Online (Sandbox Code Playgroud)
您甚至可以更进一步,只覆盖特定视图的颜色,例如按钮:
<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>
Run Code Online (Sandbox Code Playgroud)
如果您想做更多主题,请查看 Android 源代码,这是了解您能做什么和不能做什么的最佳位置!:
https://github.com/android/platform_frameworks_base/tree/master/core/res/res/values