如何在Android适用于Android Oreo及更高版本的Android Material EditText中更改气泡光标的颜色?

问题描述

我想将EditText上光标的气泡颜色从蓝色更改为绿色。

enter image description here

我使用了下面的代码

in style.xml

<style name="TextInputLayoutAppearance" parent="Widget.Design.TextInputLayout">
    <item name="colorControlnormal">@color/brand_color</item>
    <item name="colorControlActivated">@color/brand_color</item>
    <item name="colorControlHighlight">@color/brand_color</item>
</style>

这是我的片段中的TextInputLayout及其editText

<com.google.android.material.textfield.TextInputLayout
            android:id="@+id/email_login_textInputLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="32dp"
            android:layout_marginEnd="16dp"
            android:theme="@style/TextInputLayoutAppearance"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/imageView_back_button">


        <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/email_textView_login"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ems="10"
                android:hint="@string/email"
                android:inputType="textEmailAddress" />

    </com.google.android.material.textfield.TextInputLayout>

我正在使用我的gradle中的材料支持设计

implementation 'com.google.android.material:material:1.2.1'

我可以在Android Lollipop设备(API 21,三星)中成功将颜色从蓝色更改为绿色,但是我仍然无法为Android 10(API 29,Redmi Note 7)更改气泡颜色

事实上,我什至不知道这种蓝色的来源。我的color.xml中没有蓝色

我该怎么办?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)