【问题标题】:MotionLayout multi state transition is not smoothMotionLayout 多状态转换不流畅
【发布时间】:2021-03-04 22:46:34
【问题描述】:

我有三种状态ABC

OnSwipe 我从 AB,然后用另一个 OnSwipeBC强>。

滑动的方向是相同的。因此,从状态 A 连续拖动最终应该会进入状态 C

我面临的问题是过渡不顺畅。在第一个过渡结束时有一个停止。有时当我快速拖动时它工作顺利(?)。但一般来说,在两次转换中间会有一个冻结。

有什么办法可以摆脱这种冻结?

作为参考,我只是测试谷歌团队提供的samples。下面给出了两个转换

    <Transition
        motion:constraintSetStart="@id/base_state"
        motion:constraintSetEnd="@id/half_people"
        motion:duration="3000">
        <OnSwipe
            motion:dragDirection="dragRight"
            motion:touchAnchorId="@id/people_pad"
            motion:touchAnchorSide="right" />
    </Transition>

    <Transition
        motion:constraintSetStart="@id/half_people"
        motion:constraintSetEnd="@id/people"
        motion:duration="3000">
        <OnSwipe
            motion:dragDirection="dragRight"
            motion:touchAnchorId="@id/people_pad"
            motion:touchAnchorSide="right" />
    </Transition>

【问题讨论】:

    标签: android-constraintlayout android-transitions android-motionlayout


    【解决方案1】:

    简短回答否,但您可以尝试调整动作:dragThreshold 在 onswipe 中。

    长答案 在 B 处,它评估存在另一个可以加载该转换的转换。

    1. 切换转换的计算成本很高。
    • 约束集需要通过约束布局进行评估。
    • 需要为所有移动对象构建单调样条线。
    1. 存在延迟以确保拖动方向相同。

    从长远来看,我们希望构建一个将转换链接起来的转换集。 所以没有逻辑上的中断。 中期来看,我们正在考虑为过渡添加“点击停止”。所以你从一个过渡开始,然后它会到达那个停止。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-23
      相关资源
      最近更新 更多