设置 EditText 光标颜色 [英] Set EditText cursor color
问题描述
我在平板电脑项目上使用 Android 的 Holo 主题时遇到了这个问题.但是,我在屏幕上有一个白色背景的片段.我在这个片段上添加了一个 EditText
组件.我试图通过设置 Holo.Light 主题资源的背景来覆盖主题.但是,我的文本光标(克拉)仍然是白色的,因此在屏幕上不可见(我可以在编辑文本字段中隐约发现它......).
I am having this issue where I am using the Android's Holo theme on a tablet project. However, I have a fragment on screen which has a white background. I am adding an EditText
component on this fragment. I've tried to override the theme by setting the background of the Holo.Light theme resources. However, my text cursor (carat) remains white and hence, invisible on screen (I can spot it faintly in the edittext field..).
有谁知道如何让 EditText 使用较暗的光标颜色?我试过将 EditText 的样式设置为 "@android:style/Widget.Holo.Light.EditText"
没有任何积极的结果.
Does anyone know how I can get EditText to use a darker cursor color? I've tried setting the style of the EditText to "@android:style/Widget.Holo.Light.EditText"
with no positive result.
推荐答案
将 android:textCursorDrawable
属性设置为 @null
应该会导致使用 android:textColor
作为光标颜色.
Setting the android:textCursorDrawable
attribute to @null
should result in the use of android:textColor
as the cursor color.
属性textCursorDrawable"在 API 级别 12 及更高版本中可用
Attribute "textCursorDrawable" is available in API level 12 and higher
这篇关于设置 EditText 光标颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!