gpt4 book ai didi

仅搜索对话框的 Android 样式/主题

转载 作者:太空宇宙 更新时间:2023-11-03 13:03:53 25 4
gpt4 key购买 nike

tl;dr:应用主题中的白色文本样式被搜索对话框选中,使搜索文本不可见。

我正在为看似微不足道的问题而苦苦挣扎。

我的应用使用深色背景,我使用 #EEEEEE 将文本颜色调整为比标准灰色更亮。

我已经实现了一个搜索对话框( hive 之前)并且它运行良好,但是搜索对话框中的文本选择了相同的#EEEEEE,因此它基本上是不可见的。甚至当我长按搜索文本时显示的上下文菜单也会选择#EEEEEE,因此那里的文本也是不可见的。

我的头发都快掉光了。

风格:

<style name="master" paret="@android:style/Theme.NoTitleBar">
<item name="android:textColor">#EEEEEE</item>
<item name="android:windowNoTitle">true</item>
</style>

list :

<application android:icon="@drawable/icon"
android:label="@string/app_label"
android:theme="@style/master"
android:hardwareAccelerated="true"
android:debuggable="true">

最佳答案

属性 android:textColor 不打算在主题样式中使用,它主要用于小部件和文本外观样式。

如果您想通过主题更改一般文本颜色,请改用 android:textColor* 系列属性。其中有很多,不同的 View 使用它们的方式不同,因此需要进行一些实验(或仔细研究 Android 源代码)才能正确使用。 android.R.attr文档列出了所有这些。查找以 textColor... 开头的属性。

为了让您开始,请尝试这个主题,它会表现得更好,因为它根本不会影响搜索对话框的颜色,这似乎是您想要的。顺便说一下,您不需要在主题中将 android:windowNoTitle 设置为 true,因为您的父主题已经这样做了:

<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>

关于仅搜索对话框的 Android 样式/主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7547226/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com