EditText hint visibile while transition
Asked Answered
A

2

13

In my app I'm using the Android Activity Slide transition. I followed a nice tutorial and everything works as expected except for the hint of my EditText, which is contained within an InputTextLayout:

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/activity_vertical_margin">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:hint="Your name"/>
</android.support.design.widget.TextInputLayout>

All the components are nicely animated, but the hint just pops up before the animation starts and remains in the final position. Do I have to add some extra code to tell the framework to animate the hint, too?

According to the Android developer documentation it should work (or at least it's not unsupported).

I'm using version 22.2 of the Support Design Library.

It would be great if someone could point me in the right direction.

Accommodating answered 23/12, 2015 at 16:5 Comment(2)
Noticed the same on Android 5.1.1 and Support library version 23.1.1 still. Anyone ever find a solution?Markham
Not fixed in support library 24 :(Gudrunguelderrose
E
8

Try this solution, it works for me:

When you have >1 TextInputLayouts, put TextInputLayouts into a container

inputTextPanel : LinearLayout
  TextInputLayout
    login : EditText
  TextInputLayout
    password : EditText

and in onCreateView:

setContentView(R.layout.login_layout)
configuration(fromSdk = 21) {
    inputTextPanel.isTransitionGroup = true
}

If you have only one, you can just

myTextInputLayout.isTransitionGroup = true
Essonite answered 12/7, 2016 at 20:50 Comment(1)
Thank you for a great solution. You can also add android:transitionGroup="true" in xml for simplicity. Just add to each TextInputLayout to avoid adding an extra LinearLayout nest.Leggat
D
1

This is a bug. I have been looking for a fix. The workaround i have used is to set hint of edittext as empty before animation and set edittext hint after animation completes. But i dont know if thats what you would like to do.

Devisor answered 26/2, 2016 at 8:33 Comment(1)
It's a workaround, but also not well animated in the sense of the material design guidelines. I think we have to wait for an official fix.Accommodating

© 2022 - 2024 — McMap. All rights reserved.