TransitionDrawable Completed

I run the animation in my Android application using the following code:

RelativeLayout layout = (RelativeLayout) findViewById(R.id.relativeLayout1);
layout.setBackgroundResource(R.drawable.translate);
final TransitionDrawable transition = (TransitionDrawable) layout.getBackground();
transition.startTransition(9000);

The animation runs for 9 seconds, and then it must be canceled.

I am currently using a countdown timer (one already works in the application) to check if 9 seconds have passed and manually canceled the transition.

Is there a better way to do this?

thank

+5
source share
2 answers

To answer my own question, there is no onCompletionListener. Instead, you need to manually count the seconds and then cancel the transition.

I also asked this question during an Android Developer video call with Google, and it could not be answered in any other way.

+5
source

. TransitionDrawable. .

, , TransitionDrawables.

+2

All Articles