2

enter image description here

How to change the cursor color of textinputedittext.

I used textcursordrawable but it doesn't work. Thanks in advance

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841

1 Answers1

3

If you want to change only the cursor color, 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="colorControlActivated">@color/...</item>
</style>

enter image description here

If you want to change the cursor color but also the box, the label..

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

enter image description here

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841