Is it possible to have the cursor of an EditText horizontally disposed and not vertically? I would like to have it like in the following image:

I have read some topics were people play with the android:textCursorDrawable, but I need it to style it for Android < 3.0. Any ideas?
EDIT: I am adding the xml of the EditText:
<EditText
android:id="@+id/edittext1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:cursorVisible="true"
android:ems="10"
android:hint="@string/id"
android:inputType="text"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:textCursorDrawable="@drawable/custom_bottom_cursor" />
I was looking for something similar , but I did not found a solution :( only one idea I had found was to set cursorVisible to false
editText.setCursorVisible(false);
then dynamically append char _ to end of edittext, a set blinking animation to end of
Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(50); //You can manage the time of the blink with this parameter
anim.setStartOffset(20);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
lastChar.startAnimation(anim);
1) Create a Cursor drawable.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<size
android:width="20dp"
android:height="1dp" />
<solid
android:color="#000000" />
<padding
android:top="-20sp"
android:bottom="1sp" />
</shape>
or however you like.
2) android:textCursorDrawable="@drawable/cursor_drawable"
But this only works with Honeycomb or higher...

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With