Question:
I’m trying to remove all padding of a TextInputLayout and a TextInputEditText, but with padding=0dp the line at the bottom of the TextInputEditText keeps it padding left and right. How I can remove this padding?This is the xml code that I’ve used.

Thank you
Answer:
You can use your own custom style for TextInputLayout as below:Your layout:
<com.google.android.material.textfield.TextInputLayout .... android:hint="Your hint text" style="@style/My.TextInputLayout.Theme" >
Then define your custom theme as below:
<style name="My.TextInputLayout.Theme" parent="Widget.MaterialComponents.TextInputLayout.FilledBox"> <item name="materialThemeOverlay">@style/MyThemePadding</item> </style> <style name="MyThemePadding"> <item name="editTextStyle">@style/MyTextInputEditText_padding</item> </style> <style name="MyTextInputEditText_padding" parent="@style/Widget.MaterialComponents.TextInputEditText.FilledBox"> <!-- Set left and right padding here --> <item name="android:paddingStart" ns2:ignore="NewApi">2dp</item> <item name="android:paddingEnd" ns2:ignore="NewApi">2dp</item> <item name="android:paddingLeft">2dp</item> <item name="android:paddingRight">2dp</item> <!-- Set top and bottom padding here --> <item name="android:paddingTop">28dp</item> <item name="android:paddingBottom">12dp</item> </style>
If you have better answer, please add a comment about this, thank you!