Android TextInputLayout和TextInputEditText光标颜色问题 [英] Android TextInputLayout and TextInputEditText cursor color problem

本文介绍了Android TextInputLayout和TextInputEditText光标颜色问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个问题,在xxx是紫罗兰色的光标之后,我想知道该放置光标的名称,我想更改颜色以匹配我的主题.我阅读了许多论坛和文档,我发现的唯一是cursorDrawable,但事实并非如此.请以正确的名称帮助我或进行解决.谢谢PD:那种东西的紫罗兰色不是我的风格或颜色.

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.

推荐答案

颜色基于 colorPrimary .

The color is based on colorPrimary.

如果要覆盖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"
    ....>

具有:

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

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

If you want to override only the cursor you can use:

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

这篇关于Android TextInputLayout和TextInputEditText光标颜色问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆