I want to change the width and color of the cursor that blinks in an Android EditText field. Is that possible?
Open the Mouse pointer window by navigating to Windows Start Menu > PC Settings > Ease of Access > Mouse pointer. You can change your pointer size by dragging the slider under Change pointer size. Choose a pointer size from 1 to 15, where 1 is the default size.
Setting the android:textCursorDrawable attribute to @null should result in the use of android:textColor as the cursor color.
res/drawable/cursor_red.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<size
android:width="5dip" />
<solid
android:color="@color/red" />
</shape>
in your EditText:
android:textCursorDrawable="@drawable/cursor_red"
note: only API 12 and above
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