android – Cursor is not visible in EditText when no text is there-ThrowExceptions

Exception or error:

I have an EditText declared as below.

<EditText 
    android:layout_margin="2dip"
    android:singleLine="true"
    android:lines="1"
    android:maxLines="1"
    android:cursorVisible="true"
    android:textCursorDrawable="@drawable/Black"
    android:textColor="@color/black"
    android:paddingLeft="5dp"
    android:paddingRight="5dp"
    android:background="@android:drawable/editbox_background"
/>

But its not not displaying the cursor, when getting focus. When I starts typing, its showing the cursor from 1st index. I want the cursor to be displayed even in empty edittext.

I have already tried setSelection(0)but nothing happened. Please help me what should I do?

How to solve:

As mentioned above, here’s the actual line

android:textCursorDrawable="@null"

fyi – @null didn’t show up as an autocomplete option

Leave a Reply

Your email address will not be published. Required fields are marked *