Skip to content Skip to sidebar Skip to footer

Android TextInputLayout And TextInputEditText Cursor Color Problem

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 docum

Solution 1:

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


Post a Comment for "Android TextInputLayout And TextInputEditText Cursor Color Problem"