androidandroid-edittextandroid-styles

Set EditText cursor color


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

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.


Solution

  • Setting the android:textCursorDrawable attribute to @null should result in the use of android:textColor as the cursor color.

    Attribute "textCursorDrawable" is available in API level 12 and higher