Skip to content

Commit b7f520d

Browse files
leticiarossiafohrman
authored andcommitted
Fix padding of TextInputEditText when an icon is present.
PiperOrigin-RevId: 235236593
1 parent db94f66 commit b7f520d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/java/com/google/android/material/textfield/TextInputLayout.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,7 +2485,8 @@ private boolean hasEndIcon() {
24852485
private void initializeEndIcon() {
24862486
if (editText != null && endIconView != null) {
24872487
if (endIconView.getParent() == null) {
2488-
endIconView.setPadding(
2488+
ViewCompat.setPaddingRelative(
2489+
endIconView,
24892490
editText.getPaddingLeft(),
24902491
editText.getPaddingTop(),
24912492
editText.getPaddingRight(),
@@ -2514,7 +2515,8 @@ private void dispatchOnEndIconInitialized() {
25142515
*/
25152516
private void addEndIconDummyDrawable() {
25162517
endIconDummyDrawable = new ColorDrawable();
2517-
endIconDummyDrawable.setBounds(0, 0, endIconView.getMeasuredWidth(), 1);
2518+
endIconDummyDrawable.setBounds(
2519+
0, 0, endIconView.getMeasuredWidth() - endIconView.getPaddingLeft(), 1);
25182520
final Drawable[] compounds = TextViewCompat.getCompoundDrawablesRelative(editText);
25192521
// Store the user defined end compound drawable so that we can restore it later
25202522
if (compounds[2] != endIconDummyDrawable) {

0 commit comments

Comments
 (0)