TransWikia.com

Android TextInputLayout and TextInputEditText cursor color problem

Stack Overflow Asked by Gaston Fassi Lavalle on February 2, 2021

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.

One Answer

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

Answered by Gabriele Mariotti on February 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP