Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set transition duration programmatically in MotionLayout?

I set a new transition manually in code like this:

intro_motion_layout.setTransition(R.id.middle, R.id.end)

Is there a way I can also set the duration this way?

I have multiple ConstraintSets defined in XML and I switch between them when the first transition is complete using onTransitionCompleted. I have one Transition in my XML and it uses duration correctly there but the following Transitions that I set in code happen very quickly and I cant find a way to change their durations.

like image 761
alisonthemonster Avatar asked Nov 28 '18 18:11

alisonthemonster


1 Answers

intro_motion_layout.setTransition(R.id.middle, R.id.end)
intro_motion_layout.setTransitionDuration(1000)
intro_motion_layout.transitionToEnd()

worked for me

like image 184
odiggity Avatar answered Nov 01 '22 15:11

odiggity