14

In my app, I have an edit text with properties:

android:inputType="none" and android:textIsSelectable="true".

It's because I have defined my own buttons to enter input (buttons, not custom keyboard). I have used

editText.requestFocus()

to make the cursor visible. Upto to android 4.0.4, the cursor is visible and not in phones running Jelly Bean. The cursor isn't visible but I'm able touch and enter text between characters ( using editText.getSelectionStart() ).

What has changed in Jelly Bean? How do I make the cursor visible?

Edit: android:cursorVisible="true" isn't helping.

Frozen Crayon
  • 5,172
  • 8
  • 36
  • 71

5 Answers5

38

Removing android:textIsSelectable="true (text is selectable even without this)

and adding

android:textCursorDrawable="@null" fixed the issue.

Frozen Crayon
  • 5,172
  • 8
  • 36
  • 71
  • 2
    The cursor could be invisible because it blends with the background colour. The `null` above forces it to use the `android:textColor` – Ujjwal Singh Dec 24 '15 at 08:15
11

In Jellybeans, it happens if you set background to editText.

To show cursor in editText, just use android:textCursorDrawable="@null" and android:textColor="@color/someColor"

Shrikant Ballal
  • 7,067
  • 7
  • 41
  • 61
0

Try adding the following:

android:clickable="false"
Andre Amaral Braga
  • 321
  • 1
  • 7
  • 23
0

Setting android:textCursorDrawable="@android:drawable/my_cursor_drawabl" as shown below.

Theme's editText style :

<item name="android:editTextStyle">@style/myEditText</item>

Following drawable to set the cursor:for android:textCursorDrawable property of edit-text

<style name="myEditText" parent="@android:style/Widget.Holo.Light.EditText">
    <item name="android:background">@android:drawable/editbox_background_normal</item>
    <item name="android:textCursorDrawable">@android:drawable/my_cursor_drawable</item>
    <item name="android:height">45sp</item>
</style>

check this

Community
  • 1
  • 1
kyogs
  • 6,766
  • 1
  • 34
  • 50
0

Remove the background attribute from the parent. e.g android:background="#FFFFFF"

Sahil Jain
  • 629
  • 7
  • 12