运动布局将约束属性添加到过渡

问题描述:

我有一个简单的动作布局,可以从一种布局更改为另一种布局。

I have a simple motion layout that changes from one layout to another.

<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:motion="http://schemas.android.com/apk/res-auto"
    xmlns:app="urn:oasis:names:tc:xliff:document:1.2">

    <Transition
        motion:constraintSetStart="@layout/activity_new"
        motion:constraintSetEnd="@layout/activity_new_ii"
        motion:duration="1000">
    </Transition>

</MotionScene>

在这里,我还想为布局动画制作动画,这是动态布局的直接子代。该文档显示了分别应用于视图的约束属性。就像在 atricle 中一样。如何将属性添加到布局之间的过渡。

Here I also want to animate a layouts aplha which is a direct child of the motionlayout. The docs show constraint attributes applied to views individually. like in this atricle. How does one add the attribute to the transition between the layouts.

您不能使用运动布局在不同的布局(即不同活动的布局)之间设置动画。运动布局仅使其中的视图具有动画效果。
另一方面,您可以将要转换的两种布局都包含在运动布局中,然后从那里开始...

You cannot use motion layout to animate between different layouts (i.e. layouts of different activities). Motion layout only animates the views inside of it. On the other hand, you could include both layouts that you want to transition inside of the motion layout and start from there...