25

I'm trying to make the pointer color of EditText to become blue.

Droplet looking thing is the pointer

I'm able to make the underline and the cursor to become blue, but the droplet looking pointer is still grey.

I google a bit, but all the links that appear only talk about how to change the cursor, not the pointer. So if anybody knows how to do this, I need your help.

I only need to support Android 5.0 and above. So if your solution only works on API > 21, that's totally fine.

Thanks!

I'm a frog dragon
  • 7,865
  • 7
  • 46
  • 49
  • That's a duplicate to http://stackoverflow.com/questions/15133926/android-change-color-appearance-of-edittext-select-handle-anchor. – CoolMind Dec 08 '15 at 16:07

3 Answers3

12

in your styles.xml put like this:

<item name="colorAccent">@color/blue</item>
Shia G
  • 1,444
  • 11
  • 10
  • 3
    This is not a good solution. It changes cursor color for all views in an application. See http://stackoverflow.com/questions/15133926/android-change-color-appearance-of-edittext-select-handle-anchor for a right solution. – CoolMind Dec 08 '15 at 16:09
  • 1
    if we want to keep the accent color same but change the color of text selector pointer only for one particular EditText then how to do it ? – mushahid Dec 16 '15 at 14:53
  • @CoolMind You can set it on a specific activity as well, you don't need to set the theme on every activity. – LukeWaggoner Nov 28 '16 at 16:21
  • This solution is not valid for Android version 5.0. It changes everything: cursor, handler and underlininig. – Juan José Melero Gómez Feb 16 '17 at 16:02
  • It also changes the underline color. What if we want different colors for both underline and pointer – Muhammad Hanzilah Mar 17 '23 at 11:05
9

I recognize this is really late, but if all you want to do is change the color of the handle, you just need to add the following to your styles.xml file.

<style name="ColoredHandleTheme">
    <item name="colorControlActivated">@color/colorYouWant</item>
</style>

Or if you want to set it app-wide, you can do the following:

<style name="ColoredHandleThemeForWholeApp">
    <item name="colorAccent">@color/colorYouWant</item>
</style>

And then just set the theme on whatever activity is holding the EditText which you want to affect.

Problem solved!

LukeWaggoner
  • 8,869
  • 1
  • 29
  • 28
0

You may use "textSelectHandle" and set a custom drawable to get the desired output. As shown below -

<style name="MyCustomTheme">
    <item name="android:textSelectHandle">@drawable/middle_icon</item>
</style>