Search code examples
androidandroid-layoutandroid-textinputedittext

Problem with bubble color of TextInputEditText


i have a problem with an TextInputEditText, i want to change the color of bubble.
TextInputEditText
Xml layout file:

<com.google.android.material.textfield.TextInputLayout
        style="@style/Widget.MyTheme.TextInputLayout.OutlinedBox"
        android:id="@+id/textInputLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="50dp"
        android:layout_marginTop="50dp"
        android:layout_marginEnd="50dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textViewLogin">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Email"
            android:inputType="textEmailAddress"
            android:textColorHint="@color/white" />
    </com.google.android.material.textfield.TextInputLayout>

My style:

<style name="Widget.MyTheme.TextInputLayout.OutlinedBox" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
    <item name="boxStrokeColor">@color/white</item>
    <item name="hintTextColor">@color/white</item>
</style>

here i've tried to add

 <item name="colorControlActivated">@color/white</item>
    <item name="android:colorControlActivated">@color/white</item>
    <item name="android:colorAccent">@color/white</item>
    <item name="colorAccent">@color/white</item>

but none of these worked.


Solution

  • try this sample

    <com.google.android.material.textfield.TextInputLayout
        ..
        android:id="@+id/textInputLayout"
        android:theme="@style/TextInputLayoutAppearance" // add this line
        ..
       >
    
        <com.google.android.material.textfield.TextInputEditText
           ...
             android:id="@+id/email"
           ..
        />
    </com.google.android.material.textfield.TextInputLayout>
    

    in styles.xml

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

    also check this for difference between style and theme