Controlling specific elements in a shared element animation

In my application, I have a common element that looks something like this.

 <FrameLayout
    android:id="@+id/container"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <TextView
        android:id="@+id/title"
        android:layout_margin="16dp"
        android:text="Title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
    <ImageView
        android:id="@+id/image"
        android:src="@drawable/hero_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
</FrameLayout>

In my activity, I mark imageas a common element, and thus the image proceeds to the next step. However, I want to pay off titlebefore the image transitions. It seems that I should get this work, using setSharedElementExitTransition()and setting titleas the goal, but all I try to do, this animation seems to be inoperable, and the transition image is drawn on top of the picture title.

https://halfthought.wordpress.com/2014/12/08/what-are-all-these-dang-transitions/ SO, :)

+4
1

, , setTransitionName("text")

  • Activity A:

    getWindow().setSharedElementExitTransition(new TransitionSet().
                addTransition(new Fade().addTarget("text"));
    
  • startActivity() setVisibility(View.INVISIBLE). , .

INVISIBLE , , . , Window.setReturnTransition().

+3

Source: https://habr.com/ru/post/1570764/


All Articles