1

The EditText cursor is visible on Android 4.0 or a lower version, but in the Android 5.0 (Lollipop) version it is not showing. How can I fix this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rooney
  • 1,195
  • 10
  • 18

2 Answers2

1

Add android:cursorVisible="true"and android:focusableInTouchMode="true" in your XML file.

Example:

<EditText 
    android:id="@+id/textLabel"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:cursorVisible="true" 
    android:focusableInTouchMode="true"/>

Sometimes EditText requires focus to show the cursor so maybe it will help you.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Eric Brandwein
  • 861
  • 8
  • 23
1

I've solved this problem to do it like this link.

The problem is that I was using it like this:

<EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:maxLength="50"
    android:textColor="#666666"
    android:textCursorDrawable="#666666"/>

If you are going to use textCursorDrawable, you should use drawable res to the value like this:

android:textCursorDrawable="@drawable/red_cursor"
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rooney
  • 1,195
  • 10
  • 18