在Android动画中,pivotX和pivotY的含义是什么?

sru*_*ula 43 android android-animation

这两个术语出现在很多地方,但它们在Android动画的背景下究竟是什么意思呢?

Nik*_*ono 56

pivotX和pivotY是动画的中心点.
因此,例如,如果您想要放大动画,您可以使用它

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="1000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="3"
        android:toYScale="3" >
    </scale>

</set>
Run Code Online (Sandbox Code Playgroud)

android:pivotX="50%"android:pivotY="50%"将意味着变焦将被从中心开始.

还有一个很好的教程由Android蜂巢这里

  • 阅读这篇文章后听到你要求缩小,真是太可悲了 (3认同)