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.

stark
  • 2,246
  • 2
  • 23
  • 35
dmorawetz
  • 497
  • 4
  • 12

2 Answers2

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
cVoronin
  • 1,341
  • 15
  • 21
  • 4
    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. – tylerjroach Dec 07 '16 at 22:14
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.

Ragesh Ramesh
  • 3,470
  • 2
  • 14
  • 20
  • 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. – dmorawetz Feb 26 '16 at 08:52