Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cursor is not visible in EditText when no text is there [duplicate]

Tags:

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?

like image 254
Chandra Sekhar Avatar asked Apr 04 '13 07:04

Chandra Sekhar


People also ask

How do I edit EditText Uneditable?

If you want your disabled EditText to look the same as your enabled one, you should use android:enabled="false" in combination with android:textColor="..." . Show activity on this post. Used this if you have an icon to be clickable, this works for me.


1 Answers

As mentioned above, here's the actual line

android:textCursorDrawable="@null" 

fyi - @null didn't show up as an autocomplete option

like image 119
Gene Bo Avatar answered Sep 30 '22 14:09

Gene Bo