There is always a default background on TextInputLayout in Android There is always a default background on TextInputLayout in Android android android

There is always a default background on TextInputLayout in Android


https://github.com/material-components/material-components-android/issues/102

It seems a material textfield bug.
You can use this code to change background white temporarily.

<com.google.android.material.textfield.TextInputLayout   app:boxBackgroundColor="@android:color/transparent"    android:background="@android:color/transparent">   <com.google.android.material.textfield.TextInputEditText/></com.google.android.material.textfield.TextInputLayout>


One way to remove the background color is to adjust the background mode of TextInputLayout.

app:boxBackgroundMode="none"

Worked for me.

Example XML Code:

<com.google.android.material.textfield.TextInputLayout            android:layout_width="match_parent"            android:layout_height="wrap_content"            app:boxBackgroundMode="none"            app:errorEnabled="true"            app:hintEnabled="false"            app:layout_constraintTop_toTopOf="parent">            <com.google.android.material.textfield.TextInputEditText                android:layout_width="match_parent"                android:layout_height="wrap_content"                android:gravity="top"                android:hint="@string/comment_placeholder"                android:inputType="textCapSentences|textMultiLine"                android:maxLength="500" />        </com.google.android.material.textfield.TextInputLayout>


For me it worked with app:boxBackgroundColor="@null", like this:

    <com.google.android.material.textfield.TextInputLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        app:boxBackgroundColor="@null"        android:hint="@string/description">        <com.google.android.material.textfield.TextInputEditText            android:id="@+id/description"            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:inputType="textMultiLine|textCapSentences" />    </com.google.android.material.textfield.TextInputLayout>