How can i create a cursor similar to the image which have different textcolor
Asked
Active
Viewed 76 times
2
-
1http://stackoverflow.com/questions/11649234/change-edittext-cursor-color check this – Vaisakh Apr 24 '15 at 07:48
-
@Blackbelt in that i can get only same clolor for cursor and text i need different color for those – Vishnu V S Apr 24 '15 at 07:55
3 Answers
2
Try something like this:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#00ff00"/>
<size android:width="1dp"/>
</shape>
EditText in layouts.
<?xml version="1.0" encoding="utf-8"?>
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textCursorDrawable="@drawable/greencursor"
>
</EditText>
Krupa Patel
- 3,163
- 3
- 19
- 27
2
What about the styles.xml ?
<item name="colorControlNormal">@color/accentColor</item>
<item name="colorControlActivated">@color/accentColor</item>
<item name="colorControlHighlight">@color/accentColor</item>
Waqar ul islam
- 358
- 1
- 15
-
http://stackoverflow.com/questions/11649234/change-edittext-cursor-color you are just copy and pasted the code :) – Vaisakh Apr 24 '15 at 07:52
0
Set android:textCursorDrawable
to @null
like,
android:textCursorDrawable="@null"
Now your EditText
Cursor is same as your EditText TextColor.
UPDATE:
Then you can use the property: android:textColor
to set the color you want for your cursor.
Reference: Set EditText cursor color.