How to change bubble cursor color in Android Material EditText for Android for Android Oreo and above?

1.3k views Asked by At

I want to change the color of bubble of the cursor on my EditText, from blue to green.

enter image description here

I used the code below

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>

and here is my TextInputLayout and its editText, in my fragment

<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>

and I am using this material support design in my gradle

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

I can successfully change the color from blue to green in my Android Lollipop device(API 21, Samsung), but I still can't change that bubble color for my Android 10(API 29, Redmi Note 7)

In fact, I don't even know where this blue color comes from. I don't have blue color in my color.xml

what should I do ?

0

There are 0 answers