Motion Layout reset on navigating between activities

前端 未结 4 773
鱼传尺愫
鱼传尺愫 2021-01-19 04:23

I am using motion layout in my mainactivity. It is working proplerly. However when I move to other activities and navigate back to my mainactivity sometimes the activity is

4条回答
  •  生来不讨喜
    2021-01-19 04:55

    You can add a transition listener to the motion layout & save a flag when the transition is completed. Afterwards, when the activity gets recreated, you can read that flag and use smth like:

    motionLayout.setState(R.id.end, ConstraintSet.WRAP_CONTENT, ConstraintSet.WRAP_CONTENT)

    Where R.id.end is the id from constraintSetEnd property.

提交回复
热议问题