You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
setup TextInputLayout with app:endIconMode="clear_text"
insert or print long text without new line separator (for instance "aaaaaaaaaaaaa" or "aa dfg sdf" multiple times), until multiple wrapping to the next line
clear focus from TextInputEditText/TextInputLayout
focus on TextInputEditText again and clear all text(via endIcon or software keyboard)
Expected result: TextInputLayout is resizing to its initial height Actual result: TextInputLayout is stuck with current height
Problem happens only if TextInputLayout is losing focus. Otherwise it's resizing correctly.
After some researh I figure out that after losing focus editText has wrong mMinHeight.
As far as I understand, problem is in private boolean updateEditTextHeightBasedOnIcon in TextInputLayout.java:
// We need to make sure that the EditText's height is at least the same as the end or start
// icon's height (whichever is bigger). This ensures focus works properly, and there is no
// visual jump if the icon is enabled/disabled.
int maxIconHeight = Math.max(endLayout.getMeasuredHeight(), startLayout.getMeasuredHeight());
if (editText.getMeasuredHeight() < maxIconHeight) {
editText.setMinimumHeight(maxIconHeight);
return true;
}
I was able to fix this using setCompoundDrawablesRelativeWithIntrinsicBounds setting the icon in the end parameter and managing the icons with a textwatcher
Just verified this bug still exists in the latest version. Just a little more clarification. This can only be reproduced if the number of lines changes while losing and regaining focus with the clear_text end icon mode in use.
Description:
Expected result: TextInputLayout is resizing to its initial height
Actual result: TextInputLayout is stuck with current height
Problem happens only if TextInputLayout is losing focus. Otherwise it's resizing correctly.
After some researh I figure out that after losing focus editText has wrong mMinHeight.
As far as I understand, problem is in private boolean
updateEditTextHeightBasedOnIcon
in TextInputLayout.java:Source code:
Minimal sample app repro:
https://github.com/NutsHell912/TextInputLayoutWrongResizing
Android API version: tested on API 30, 32, 33
Material Library version: 1.9.0
Device: emulators, TCL 306, Motorola G9
The text was updated successfully, but these errors were encountered: