Android TextInputLayout 和 TextInputEditText 光标颜色问题

Android TextInputLayout and TextInputEditText cursor color problem

我有这个问题,xxx 是紫色的光标后,我想知道那个放置光标的名称,我想更改颜色以匹配我的主题。我阅读了很多论坛和文档,我唯一找到的是 cursorDrawable,但不是那个。请帮助我提供正确的搜索名称或解决方案。 谢谢 PD:那个东西的紫罗兰色不在我的风格或颜色中。

颜色基于colorPrimary.

如果您想覆盖 colorPrimary,您可以使用:

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

与:

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

如果您只想覆盖光标,您可以使用:

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