mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-20 08:39:55 +08:00
Brief explanation: in TextInputLayout#onMeasure, TextInputLayout will try to send a post to trigger requestLayout() method based on the boolean value returned from updateDummyDrawbles() method, but in shouldUpdateEndDummyDrawable(), we try to get the endLayout.getMeasureWidth() which is not reliable, if the endLayout hasn't rendered fully, the getMeasureWidth() will return 0 making the updateDummyDrawables() to return TRUE to trigger requestLayout() in an infinite loop. To fix this issue, we need to introduce ViewTreeObserver to help us to run posing the requstLayout() after endLayout/startLayout is fully rendered. PiperOrigin-RevId: 571765829