Based on Gabriels answer, I wrote a small method to run after loading the hierarchy of views, which disables the animation on initial display, but allows it after the guardians. Add this to your base activity / snippet / view and this will solve the problem.
private void setTextInputLayoutAnimation(View view) { if (view instanceof TextInputLayout) { TextInputLayout til = (TextInputLayout) view; til.setHintAnimationEnabled(false); til.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { til.getViewTreeObserver().removeOnPreDrawListener(this); til.setHintAnimationEnabled(true); return false; } }); return; } if (view instanceof ViewGroup) { ViewGroup group = (ViewGroup) view; for (int i = 0; i < group.getChildCount(); i++) { View child = group.getChildAt(i); setTextInputLayoutAnimation(child); } } }
source share