I'm developing a new app where i need to customise EditText cursor colour and width of cursor. Can any one please guide me.It will be appriciable. Thanks in advance.
Build your new drawable for cursor for example name it my_custom_cursor_drawable.xml in the drawable folder
my_custom_cursor_drawable.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<size android:width="0.5dp" />
<solid android:color="#FF0910DD"/>!--Could be any color you want
</shape>
The EditBox where you want this custom cursor set the property as
android:textCursorDrawable="@drawable/cursor_drawable"
Thats it !! improvise if need be. Any drawable , any shape etc...
You can define a custom drawable for the EditText Cursor and use it for EditText using android:textCursorDrawable
.
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