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.
Late to the party,Here's is my answer,
This is for the people who are not looking to change the
colorAccent
in their parent theme,but wants to changeEditText
attributes!Example:
Now create a drawable(
edit_text_background
) add a resource xml for the background!You can customize as you want!Now as you did set this style in your Activity theme.
Example :
In your Activity you have a theme,set this custom
editText
theme to that.are you want specific color you must use AppCompatEditText then backround set null
works for me
See this gist
Setting the
android:textCursorDrawable
attribute to@null
should result in the use ofandroid:textColor
as the cursor color.Attribute "textCursorDrawable" is available in API level 12 and higher
I found the answer :)
I've set the Theme's editText style to:
Then I've used the following drawable to set the cursor:
`
`
android:textCursorDrawable is the key here.
Wow I am real late to this party but it has had activity 17 days ago It would seam we need to consider posting what version of Android we are using for an answer so as of now this answer works with Android 2.1 and above Go to RES/VALUES/STYLES and add the lines of code below and your cursor will be black
You will need a this line of code in your RES/COLOR folder
Why post this late ? It might be nice to consider some form of categories for the many headed monster Android has become!
Then create drawalble xml:
color_cursor