是否可以更改 Android SearchView 上的文本颜色? [英] Is it possible to change the textcolor on an Android SearchView?

查看:33
本文介绍了是否可以更改 Android SearchView 上的文本颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SearchView 元素没有任何用于更改文本颜色的属性.默认文本颜色为黑色,不适用于我们的深色背景.有没有办法在不求助于黑客的情况下改变文本的颜色?

The SearchView element doesn't have any properties for changing the text color. The default text color is black and doesn't work on our dark background. Is there a way to change the color of the text without resorting to hacks?

我发现这个与更改文本大小相关的类似问题,但到目前为止,它没有任何答案:如何设置 SearchView TextSize?

I found this similar question related to changing the text size, but so far, it doesn't have any answers: How to set SearchView TextSize?

推荐答案

添加

<item name="android:editTextColor">@android:color/white</item>

到父主题,这应该会更改输入的文本.您也可以使用

to the parent theme and that should change the entered text. You can also use

<item name="android:textColorHint">@android:color/white</item>

更改 SearchView 的提示文本颜色.(请注意,您可以将 @android:color/white 替换为您希望使用的任何适当值)

to change the hint text color for the SearchView. (Note that you can replace the @android:color/white with whatever appropriate value you're hoping to use)

这篇关于是否可以更改 Android SearchView 上的文本颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆