material-components-android
material-components-android copied to clipboard
[TextInputEditText] The highlight color is different from the cursor color
I used all the styling attributes in the theme. (Except for additional attributes).
The theme is night and day. Theme.Material3.Light.NoActionBar and dark respectively
Why can't the selection color be changed? Even colorControlActivated and colorPrimary inside the TextInputEditText style does not save. The first attribute changes only the color of the cursor itself. There is zero information on this on the Internet at all.
I found a solution in the dynamic Material 3 styles code. You need to use android:textColorHighlight attribute to change the color of the text selection. I ask developers to document this attribute in Material3 documentation, because it is very time consuming to find the answer. Especially in Material Components such problems were solved by using accent attribute.
I remember reporting the same issue back in #2452. The maintainers said that they would discuss this, but there has been no updates since.
This is the offending text color in the library, which hard-codes a text color instead of using an attribute.
@drchen Any updates on if text highlighting will be changed to use color attributes?
Hi, I will update the text field documentation to include information about android:textColorHighlight
, (programmatically you can also call setHighlightColor
on the edit text). We don't currently have plans on introducing a different attr for that
Yeah, not surprised you aren't considering it, given that making the text color highlight color rely on attrs will not work <API 23.
That is disappointing to hear that the highlight color will not automatically adjust. This is contrary to how the rest of the theming system behaves.
Any updates? We have the same issue