I created my own EditTextclass that extends android.widget.EditText. When you run the application on KitKat and previous versions of the OS, if the user is EditTextempty, the cursor is not displayed. It will appear after entering text.
I tried several solutions hosted on this site, including adding android:textCursorDrawable="@null"and android:textIsSelectable="true"in XML, as well as adding these properties programmatically. None of these solutions worked.
Custom EditTexthas a background that I set, but it should be there. Design restrictions mean that I have to set a background other than the standard one.
So the question is how to make the cursor appear when the user is EditTextempty?
Here is the XML for the custom view:
<?xml version="1.0" encoding="utf-8"?>
<com.example.CustomEditText
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:background="@drawable/custom_edit_text_background"
android:gravity="start"
android:imeOptions="actionDone"
android:inputType="textCapSentences|textMultiLine"
android:maxLines="5"
android:padding="@dimen/custom_padding"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@color/custom_color"/>
source
share