Skip to content

Instantly share code, notes, and snippets.

@mediavrog
Created June 4, 2014 02:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mediavrog/9970ad4f97a309542e52 to your computer and use it in GitHub Desktop.
Save mediavrog/9970ad4f97a309542e52 to your computer and use it in GitHub Desktop.
Cursor not visible in EditText in Jelly Bean - this happens if you set a background for the field; to fix it, set the cursorDrawable to @null. Always use this combination when using custom backgrounds.
<EditText
android:id="@+id/my_edit_text"
...
android:background="@drawable/some_bg"
android:textCursorDrawable="@null" />
@GeorgCantor
Copy link

thanks bro!

@turastory
Copy link

What if I want to change the color of the cursor?? Here's what I'm using.

<EditText
    android:background="@null"
    android:textCursorDrawable="@color/coral"/>

This works in most of devices, but doesn't work on API 16. (Kitkat)
Any Ideas?

@turastory
Copy link

Well I've searched for a while, and found a solution.
See this answer.
Use drawable instead of color for textCursorDrawable.

<EditText
    android:background="@null"
    android:textCursorDrawable="@color/coral"/>

@joshuapinter
Copy link

Holy shit, dude. That's been bugging me for years! Thanks for finding this out, it works great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment