angeImageTransform两种活动之间的动画的Imag

angeImageTransform两种活动之间的动画的Imag

本文介绍了使用共享元素的过渡与ChangeImageTransform两种活动之间的动画的ImageView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个ImageView的动画在Android的大号preVIEW在Android的API级别21的两项活动之间的另一个位置。由于MoveImage已被删除,我用ChangeImageTransform"相反,但样本code。在文件不工作(分别动画两个图像)。

 < transitionSet的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android>
    < changeImageTransform>
        <目标>
            <目标机器人:目标=@ ID / IVA/>
            <目标机器人:目标=@ ID / IVB/>
        < /目标>
    < / changeImageTransform>
< / transitionSet>
 

有没有工作的例子吗?谢谢!

解决方案

要进行两次活动有一个共同的元素之间的屏幕过渡动画,你可以阅读这篇文章,并按照提到的步骤:

关于第三步骤,根据本documentation:

在RES /转换/ your_transition.xml应该是这样的:

 < transitionSet的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android>
    < changeBounds>
        <目标>
            <目标机器人:目标=@ ID / IVA/>
            <目标机器人:目标=@ ID / IVB/>
        < /目标>
    < / changeBounds>
    < changeImageTransform>
        <目标>
            <目标机器人:目标=@ ID / IVA/>
            <目标机器人:目标=@ ID / IVB/>
        < /目标>
    < / changeImageTransform>
< / transitionSet>
 

或者干脆像这样如果只IVA和IVB需要被激活:

 < transitionSet的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android>
    < changeBounds />
    < changeImageTransform />
< / transitionSet>
 

I am trying to animate one ImageView to another position between two activities in Android API level 21. Since "MoveImage" in Android L Preview has been removed, I use "ChangeImageTransform" instead, but the sample code in documents doesn't work out (the two images animated separately).

<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
    <changeImageTransform>
        <targets>
            <target android:targetId="@id/ivA" />
            <target android:targetId="@id/ivB" />
        </targets>
    </changeImageTransform>
</transitionSet>

Is there any working example? Thanks!

解决方案

To make a screen transition animation between two activities that have a shared element,you can read this article and follow the mentioned steps:

About the 3rd step, according to the documentation:

The res/transition/your_transition.xml should be like this:

<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
    <changeBounds>
        <targets>
            <target android:targetId="@id/ivA" />
            <target android:targetId="@id/ivB" />
        </targets>
    </changeBounds>
    <changeImageTransform>
        <targets>
            <target android:targetId="@id/ivA" />
            <target android:targetId="@id/ivB" />
        </targets>
    </changeImageTransform>
</transitionSet>

or simply like this if only ivA and ivB need to be animated:

<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
    <changeBounds/>
    <changeImageTransform/>
</transitionSet>

这篇关于使用共享元素的过渡与ChangeImageTransform两种活动之间的动画的ImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 09:38