设置的EditText光标颜色 [英] Set EditText cursor color

查看:562
本文介绍了设置的EditText光标颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个问题,我现在用的是Android的全息主题在平板电脑上的项目。不过,我在屏幕上的片段有一个白色背景。我这个片段上加入的EditText 部分。我试着通过设置Holo.Light主题资源的背景覆盖主题。然而,我的文字光标(克拉)仍然是白色的,因此,不可见的屏幕上(我可以在现场的EditText依稀察觉吧..)。

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的样式设置为@安卓风格/ 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.

推荐答案

设置安卓textCursorDrawable 属性 @null 应导致使用的android:文字颜色作为光标颜色

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

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