Motion layout add constraint attribute to transition

好久不见. 提交于 2019-12-25 03:34:27

问题


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>

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.


回答1:


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



来源:https://stackoverflow.com/questions/53993841/motion-layout-add-constraint-attribute-to-transition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!