TL;博士:在应用主题白色文本样式被拾起搜索对话框,使得搜索文本无形
我挣扎的境地什么似乎是一个微不足道的问题。
我的应用程序使用的是深色的背景,我已经调整了文本的颜色比标准使用#EEEEEE灰色变亮。
我已经实现了一个搜索对话框(pre-蜂窝)和它的作品很好,但在搜索对话框中的文字拿起一样#EEEEEE所以它本质上是不可见的。即使显示的上下文菜单时我长preSS搜索文本拿起#EEEEEE,因此文本有无形也。
我撕裂我的头发了,我跑出来的头发。
风格:
<样式名称=主帕雷特=@安卓风格/ Theme.NoTitleBar>
<项目名称=机器人:文字颜色>#EEEEEE< /项目>
<项目名称=机器人:windowNoTitle>真< /项目>
< /风格>
清单:
<应用机器人:图标=@可绘制/图标
机器人:标签=@字符串/ app_label
机器人:主题=@风格/主
机器人:hardwareAccelerated =真
机器人:可调试=真正的>
解决方案
属性安卓文字颜色
并不意味着在里面的主题风格中使用,它是主要用小工具和文字的外观样式。
机器人。有相当多的人,和不同的看法使用它们不同,因此它需要一个实验位(或谨慎的Android源$ C $ C学习),以获得这一切的权利。该 android.R.attr 文档列出他们。寻找开头的属性文字颜色...
。
为了让您一开始,试试这个主题,将通过表现不影响搜索对话框颜色可言,这似乎是你想要的更好。顺便说一句,你不需要设置安卓windowNoTitle
到真
在你的主题,你的父母主题做已经
<样式名称=主父=@安卓风格/ Theme.NoTitleBar>
<项目名称=机器人:textColorPrimary>#EEEEEE< /项目>
<项目名称=机器人:textColorSecondary>#EEEEEE< /项目>
<项目名称=机器人:textColorTertiary>#EEEEEE< /项目>
< /风格>
tl;dr: White text style in app theme being picked up by search dialog, making search text invisible.
I'm struggling mightily with what seems like a trivial issue.
My app is using a dark background, and I've tweaked the text color to be brighter than the standard gray using #EEEEEE.
I've implemented a Search Dialog (pre-Honeycomb) and it works well, but the text in the search dialog picks up the same #EEEEEE so it is essentially invisible. Even the context menu displayed when I long press the search text picks up #EEEEEE, so the text there is invisible as well.
I'm tearing my hair out, and I'm running out of hair.
Style:
<style name="master" paret="@android:style/Theme.NoTitleBar">
<item name="android:textColor">#EEEEEE</item>
<item name="android:windowNoTitle">true</item>
</style>
Manifest:
<application android:icon="@drawable/icon"
android:label="@string/app_label"
android:theme="@style/master"
android:hardwareAccelerated="true"
android:debuggable="true">
解决方案 The attribute android:textColor
is not meant to be used inside theme styles, it is primarily useful in widget and text appearance styles.
If you want to change the general text colors through a theme, use instead the android:textColor*
family of attributes. There are quite a few of them, and different Views use them differently, so it takes a bit of experimentation (or careful studying of the Android source code) to to get it all right. The android.R.attr documentation lists them all. Look for the attributes that begin with textColor...
.
To get you started, try this theme, it will behave better by not affecting the Search Dialog colors at all, which seems to be what you want. By the way, you don't need to set android:windowNoTitle
to true
in your theme as your parent theme does that already:
<style name="master" parent="@android:style/Theme.NoTitleBar">
<item name="android:textColorPrimary">#EEEEEE</item>
<item name="android:textColorSecondary">#EEEEEE</item>
<item name="android:textColorTertiary">#EEEEEE</item>
</style>