Dangui
Dangui

Reputation: 101

Background color issue of TextInputLayout in android material-components

I'm new here for android material-components , I just tried the basic TextInputLayout with FilledBox style for the first time, by default the background looks like translucent , according to our design I need to change it to pure white. But I tried app:boxBackgroundColor="#ffffff", then the text and text hint become invisible! Then I tried app:boxBackgroundColor="#80ffffff" I can see they are some kind of transparent. You know why? I just wanna pure white background and keep others same.

Thanks in advance!

<com.google.android.material.textfield.TextInputLayout
 style=".MaterialComponents.TextInputLayout.FilledBox"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:layout_marginTop="120dp"
 app:boxBackgroundColor="#ffffff">

    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#ff000000"
        android:textColorHint="#ff0000"
        android:hint="Location"/>
</com.google.android.material.textfield.TextInputLayout>

Upvotes: 5

Views: 4203

Answers (1)

Cameron Ketcham
Cameron Ketcham

Reputation: 8006

This is a bug in the alpha version of the material library where the background is drawn on top of the text. It will be fixed in the next release.

Upvotes: 2

Related Questions