So I changed the style of the Holo Theme with the Holo Colors Generator and Action Bar Style Generator to my own color. But when I select text inside an edit text, the "markers" at the selected positions are still blue. How can I change it?
When you create an anchor tag in HTML, which is a tag which directs a user to another web page, by default, the tag comes in a blue color. Below is an example of a common anchor tag you'd created which comes with this default color: Though this colors appear by default, it can be changed to any color which we want by using CSS.
This example demonstrate about how to change line color in EditText. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
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>
Android – EditText on text change EditText is used to read input from user. A listener could be attached to the EditText to execute an action whenever the text is changed in the EditText View.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With