Material-components-android: background color of TextInputLayout

Created on 12 May 2018  路  9Comments  路  Source: material-components/material-components-android

Hi guys, I'm new here, I just tried the basic TextInputLayout 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!

style="@style/Widget.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"/>

Most helpful comment

bug not fixed,i am using com.google.android.material:material:1.1.0-alpha02
<com.google.android.material.textfield.TextInputLayout android:layout_width="match_parent" app:hintEnabled="false" app:boxBackgroundColor="@color/transparent" app:passwordToggleEnabled="true" android:paddingLeft="@dimen/padding_very_small_8" android:gravity="center_vertical" android:background="@color/transparent" android:layout_height="match_parent"> <com.google.android.material.textfield.TextInputEditText tools:text="assdasdasdasd" android:inputType="textPassword" android:textSize="@dimen/text_size_small_10" android:hint="@string/password_text" android:textAlignment="gravity" android:background="@color/transparent" android:layout_width="match_parent" android:gravity="center_vertical" android:layout_height="match_parent"/> </com.google.android.material.textfield.TextInputLayout>

background showing white

All 9 comments

@houdangui1985 Thanks for reporting this issue. I looked into it and it appears that the box background draw() was getting called after the other draw() calls, which caused the background to be drawn on top of the other text field elements. I have a fix for this in the works, it should be in soon.

In which version is this bug fixed? I still have this issue with support 28.0.0-alpha1

bug not fixed,i am using com.google.android.material:material:1.1.0-alpha02
<com.google.android.material.textfield.TextInputLayout android:layout_width="match_parent" app:hintEnabled="false" app:boxBackgroundColor="@color/transparent" app:passwordToggleEnabled="true" android:paddingLeft="@dimen/padding_very_small_8" android:gravity="center_vertical" android:background="@color/transparent" android:layout_height="match_parent"> <com.google.android.material.textfield.TextInputEditText tools:text="assdasdasdasd" android:inputType="textPassword" android:textSize="@dimen/text_size_small_10" android:hint="@string/password_text" android:textAlignment="gravity" android:background="@color/transparent" android:layout_width="match_parent" android:gravity="center_vertical" android:layout_height="match_parent"/> </com.google.android.material.textfield.TextInputLayout>

background showing white

Please, transparents colors arent working in alpha 3 version...

Not working on com.google.android.material:material:1.1.0-alpha04 either

re: setting transparent box background color, please see https://issuetracker.google.com/issues/122445449

It's also actual on version - com.google.android.material:material:1.3.0-alpha02..

@posix-dev how did you get it to work? I upgraded to 1.3.0-alpha02 and the problem persists..

Edit: My problem was that I didn't set the theme to inherit from Material Components.

Was this page helpful?
0 / 5 - 0 ratings