Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android TextInputLayout and TextInputEditText cursor color problem

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.

like image 684
Gaston Fassi Lavalle Avatar asked May 07 '26 10:05

Gaston Fassi Lavalle


1 Answers

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

like image 142
Gabriele Mariotti Avatar answered May 08 '26 23:05

Gabriele Mariotti