android edittext cursor color

      Comments Off on android edittext cursor color

android edittext cursor color

android edittext cursor color

android edittext cursor color tutorial focus on how to set color of your cursor in android edittext. you might be wondering that how automatically android is taking color for android edittext cursor and unable to find the method to set cursor color. Check out sample code to change color in android.

Android has many possibilities, Just we need to explore it. I will try to explore as much capabilities as I can. Here is sample code have a look at:

Android Method 1 to change color:

<EditText
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:textCursorDrawable=”@drawable/color_cursor_drawable”/>

Drawable for cursor color
<?xml version=”1.0″ encoding=”utf-8″?>
<shape xmlns:android=”http://schemas.android.com/apk/res/android” >
<size android:width=”3dp” />
<solid android:color=”#FFFFFF”  />
</shape>

Android Method 2 to change color:

Set android:textCursorDrawable to null and set your android:textColor

PS:
If you like my article, Please share with your friends on Facebook, WhatsApp, Twitter, etc. Thanks in Advance.