How to change color / appearance of EditText select handle / anchor?

The worst part here was to find the "name" for this item and how it is called inside the theme. So I looked through every drawable in the android SDK folder and finally found the drawables named "text_select_handle_middle", "text_select_handle_left" and "text_select_handle_right".

So the solution is simple: Add these drawables with customized design/color to your drawable folder and add them to your theme style definition like:

<style name="MyCustomTheme" parent="@style/MyNotSoCustomTheme">
        <item name="android:textSelectHandle">@drawable/text_select_handle_middle</item>
        <item name="android:textSelectHandleLeft">@drawable/text_select_handle_left</item>
        <item name="android:textSelectHandleRight">@drawable/text_select_handle_right</item>
</style>

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>

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

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 set that theme for the whole app.

Problem solved!


How to do it from code:

try {
    final Field fEditor = TextView.class.getDeclaredField("mEditor");
    fEditor.setAccessible(true);
    final Object editor = fEditor.get(editText);

    final Field fSelectHandleLeft = editor.getClass().getDeclaredField("mSelectHandleLeft");
    final Field fSelectHandleRight =
        editor.getClass().getDeclaredField("mSelectHandleRight");
    final Field fSelectHandleCenter =
        editor.getClass().getDeclaredField("mSelectHandleCenter");

    fSelectHandleLeft.setAccessible(true);
    fSelectHandleRight.setAccessible(true);
    fSelectHandleCenter.setAccessible(true);

    final Resources res = context.getResources();

    fSelectHandleLeft.set(editor, res.getDrawable(R.drawable.text_select_handle_left));
    fSelectHandleRight.set(editor, res.getDrawable(R.drawable.text_select_handle_right));
    fSelectHandleCenter.set(editor, res.getDrawable(R.drawable.text_select_handle_middle));
} catch (final Exception ignored) {
}

In order to change the color of select handles, you have to override the activated color in your app theme:

<style name="MyCustomTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
    <item name="android:colorControlActivated">@color/customActivatedColor</item>
</style>