我在RelativeLayout
中有Imageview
。它应该从屏幕的中心(父母)开始,然后转到特定的点。实际上我使用xml。 任何解决方案?在Android中翻译动画 - 从屏幕中心开始
我的动画XML的
<set xmlns:android="http://schemas.android.com/apk/res/android">
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="false">
<translate
android:fromYDelta="0%p"
android:fromXDelta="0%p"
android:toYDelta="0%"
android:toXDelta="0%"
android:duration="1000"
android:pivotX="0%p"
android:pivotY="0%p"/>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXScale="432px"
android:toXScale="100%"
android:fromYScale="450px"
android:toYScale="100%"
android:duration="1000"
android:pivotX="0%p"
android:pivotY="0%p" />
</set>
我和100%p, 50%p, 0%p, 100, 50, 0, 100%, 50% and 0%
试图在fromYDelta
和fromXDelta
。没有用! 现在我很困惑! 感谢您的时间和帮助
编辑:
A picture to explain what the Animation should do
你有没有试过这一个https://stackoverflow.com/questions/10276251/how-to-animate-a-view-with-translate-animation-in-android?answertab=votes#tab-top? –
这是横幅中的元素,它是顶部(32dp marginTop)和中心。但图像需要留在横幅 –
是的,我试了一下,但后来我需要想办法把它放回横幅 –