Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to change EditText cursor color?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.29k
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: