Rooney
Rooney

Reputation: 1205

EditText cursor is not visible on Android 5.0 (Lollipop)

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?

Upvotes: 1

Views: 1230

Answers (2)

Rooney
Rooney

Reputation: 1205

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"

Upvotes: 1

Eric Brandwein
Eric Brandwein

Reputation: 891

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.

Upvotes: 1

Related Questions