zeus
zeus

Reputation: 13367

how to change the color of the edittext text selection handles?

i know this question was already answered but i can't find a solution that work.

on android > lolipop (21) is their any way to change the color of my text selection handles (without uploading new png image)?

i define this style

<?xml version="1.0" encoding="utf-8"?>
<resources>

  <style name="AppEditTextStyle" parent="@android:style/Widget.Material.Light.EditText">
    <item name="android:background">@null</item>    
    <item name="android:textCursorDrawable">@null</item> 
    <item name="android:drawableTint">#00ffffff</item>           
  </style>

  <style name="AppTheme" parent="@android:style/Theme.Material.Light.NoActionBar"> 
    <item name="android:editTextStyle">@style/AppEditTextStyle</item>
  </style>

</resources>

but it's not work, i receive : Error: No resource found that matches the given name: attr 'android:drawableTint'.

but in the doc (https://developer.android.com/reference/android/widget/TextView.html#attr_android:drawableTint) it is clearly specified that android:drawableTint exist :( so i don't understand why i miss ?

Upvotes: 5

Views: 6053

Answers (1)

Bruno Ferreira
Bruno Ferreira

Reputation: 1571

In android lolipop and later the handles color is the accent color.

I suggest to read this:

Selection - Patterns - Material design guidelines

Here is the styles line:

<item name="colorAccent">@color/colorAccent</item>

And set selection color like this:

android:textColorHighlight="@color/colorAccent"

Upvotes: 3

Related Questions