以编程方式开始运动场景 [英] Start motion scene programmatically
本文介绍了以编程方式开始运动场景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个具有以下layoutDescription的运动布局: app:layoutDescription ="@ xml/scene"
I have a motion layout with this layoutDescription: app:layoutDescription="@xml/scene"
scene.xml
<MotionScene
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetStart="@layout/view_home_card_start"
motion:constraintSetEnd="@layout/view_home_card_end"
motion:duration="1000">
<OnSwipe
motion:touchAnchorId="@+id/button"
motion:touchAnchorSide="left"
motion:dragDirection="dragLeft" />
</Transition>
</MotionScene>
我认为 view_home_card_start
和 view_home_card_end
的xml是不相关的.
I think that the xml of view_home_card_start
and view_home_card_end
is irrelevant.
如何以编程方式调用此动画?
How can I call this animation programatically?
推荐答案
最后,我正在这样做:
((MotionLayout)findViewById(R.id.motionLayout)).transitionToEnd();
((MotionLayout)findViewById(R.id.motionLayout)).transitionToStart();
这篇关于以编程方式开始运动场景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文