J'ai TextInputLayout
et TextInputEditText
comme ça
<com.google.Android.material.textfield.TextInputLayout
Android:id="@+id/loginUsernameText"
Android:layout_width="match_parent"
Android:layout_height="wrap_content"
Android:layout_marginLeft="@dimen/text_input_margin_left_right"
Android:layout_marginRight="@dimen/text_input_margin_left_right"
Android:layout_marginTop="@dimen/text_input_margin_top_bottom"
Android:hint="@string/username"
Android:layout_below="@id/loginButtonLogin">
<com.google.Android.material.textfield.TextInputEditText
Android:id="@+id/loginUsername"
Android:layout_width="match_parent"
Android:padding="5dp"
Android:layout_height="wrap_content"
Android:inputType="textEmailAddress"/>
</com.google.Android.material.textfield.TextInputLayout>
<com.google.Android.material.textfield.TextInputLayout
Android:id="@+id/loginPasswordText"
Android:layout_width="match_parent"
Android:layout_height="wrap_content"
Android:layout_marginLeft="@dimen/text_input_margin_left_right"
Android:layout_marginRight="@dimen/text_input_margin_left_right"
Android:layout_marginTop="@dimen/text_input_margin_top_bottom"
Android:hint="@string/password"
Android:layout_below="@id/loginUsernameText">
<com.google.Android.material.textfield.TextInputEditText
Android:id="@+id/loginPassword"
Android:layout_width="match_parent"
Android:padding="5dp"
Android:layout_height="wrap_content"
Android:inputType="textPassword"/>
</com.google.Android.material.textfield.TextInputLayout>
Ceci est mon fichier styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="TextAppearance.App.TextInputLayout" parent="@Android:style/TextAppearance">
<item name="Android:textColor">@color/white</item>
<item name="Android:textSize">14sp</item>
</style>
</resources>
Donc, je n'utilise rien de plus sur TextInputLayout et ils apparaissent comme ceci
Ce fond gris est toujours là. Comment supprimer cet arrière-plan et obtenir simplement le TextInputLayout par défaut. Merci.
Pour moi, cela a fonctionné avec app:boxBackgroundColor="@null"
, comme ça:
<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>
Dans mon cas, il fallait changer l'arrière-plan dans TextInputLayout et TextInputEditText
<com.google.Android.material.textfield.TextInputLayout
app:boxBackgroundColor="@color/transparent"
Android:background="@color/transparent"
>
<com.google.Android.material.textfield.TextInputEditText
Android:background="@color/transparent"
/>
</com.google.Android.material.textfield.TextInputLayout>