Reputation: 63
** By using xml or design I want to change the color of cursor when i start writing i n plain text from default color to another one .. how i can do this please**
Upvotes: 0
Views: 898
Reputation: 4442
Easy way(For API level>=21)
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="colorControlActivated">@color/your_cursor_color</item>
</style>
Better way(For all API levels)
1.Define android:textCursorDrawable
in your layout
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textCursorDrawable="@drawable/color_cursor"
/>
2.Create a cursor in drawable
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<size android:width="2.5dp" />
<solid android:color="color_cursor" />
</shape>
Upvotes: 1