运动布局将约束属性添加到过渡 [英] Motion layout add constraint attribute to transition

查看:94
本文介绍了运动布局将约束属性添加到过渡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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...

这篇关于运动布局将约束属性添加到过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆