汤姆链如何过渡?

时间:2019-05-27 14:58:01

标签: android android-motionlayout

在Motionlayout中热播放一个接一个的过渡,使其看起来像单个动画吗?尽管关键帧可用于在两个约束之间建立中间状态,但它们也受到限制,无法修改所有所需的属性。
 

    <Transition

        app:constraintSetEnd="@layout/simple_start"
        app:constraintSetStart="@layout/simple_middle"

        >
        <OnSwipe
            app:dragDirection="dragUp"
            app:touchAnchorId="@id/scrollable"
            app:touchAnchorSide="top" />

    </Transition>
    <Transition

        app:constraintSetEnd="@layout/simple_middle"
        app:constraintSetStart="@layout/simple_end"

        >
        <OnSwipe
            app:dragDirection="dragUp"
            app:touchAnchorId="@id/scrollable"
            app:touchAnchorSide="top" />

    </Transition>

</MotionScene>

2 个答案:

答案 0 :(得分:0)

您是否尝试直接在代码中开始转换?

((MotionLayout)findViewById(R.id.simple_start)).transitionToEnd();
((MotionLayout)findViewById(R.id.simple_middle)).transitionToEnd();

答案 1 :(得分:0)

var sayHello = {
  // Add some magic lines here like some magic 'call' property that's invoked by JS runtime
  call: () => {
    console.log('hello :)');
  }
};

sayHello();
// Output: hello :)