8

enter image description hereProblem

I have this problem, after the xxx is the cursor in violet, I want to know the name of that drop cursor, I want to change the color to match my theme. I read many forums and documentation, the only I find was cursorDrawable, but is not that. Please help me with the correct name to search or the solution. Thanks PD: The violet color of that THING is not in my styles or colors.

1 Answers1

28

The color is based on colorPrimary.

If you want to override the colorPrimary you can use:

  <com.google.android.material.textfield.TextInputLayout                
    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
    android:theme="@style/ThemeOverlay.AppTheme.TextInputEditText.Outlined"
    ....>

with:

<style name="ThemeOverlay.AppTheme.TextInputEditText.Outlined" parent="">
    <item name="colorPrimary">@color/...</item>
</style>

enter image description here

If you want to override only the cursor you can use:

<style name="ThemeOverlay.AppTheme.TextInputEditText.Outlined" parent="">
    <item name="colorControlActivated">@color/...</item>
</style>

enter image description here

enter image description here

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • Thanks, but I mean the drop that is below the cursor, that is what i need to change. I add another image showing exactly what I mean – Gaston Fassi Lavalle Aug 28 '20 at 15:54
  • @GastonFassiLavalle The drop has the same color of the cursor. – Gabriele Mariotti Aug 28 '20 at 16:05
  • Thanks, now i need to find where is that color i try #000 #000 #000 and still is violet not black. I will try the override in styles, but I want to learn where is that violet color coming from – Gaston Fassi Lavalle Aug 28 '20 at 16:35
  • 1
    @GastonFassiLavalle The violet (`#6200EE`) is the default color defined by the [Material Theme](https://github.com/material-components/material-components-android/blob/master/docs/theming/Color.md). In your `styles.xml` just add in your app theme the `colorPrimary` attribute. Something like: ` – Gabriele Mariotti Aug 28 '20 at 17:36
  • 1
    Thanks that works, i was looking another way but is better to override. Many thanks. – Gaston Fassi Lavalle Aug 28 '20 at 19:44
  • @GabrieleMariotti any idea how to do it using Material3? – Leonardo Sibela Apr 13 '23 at 21:52