Hello,
This blog will help you to change the cursor color of Android EditText View by creating custom XML file under app's drawable folder.
By using following steps you can do it.
Step-1 Create a custom xml file custom_edit_text.xml under res/drawable folder
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<size
android:width="2dip" />
<solid
android:color="@color/green" />
</shape>
Step-2 Add attribute android:textCursorDrawable to your EditText view .
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:textCursorDrawable="@drawable/custom_edit_text"
</EditText>
Note:- This used attribute work only for Android API level 12 and higher
0 Comment(s)