【问题标题】:don't scale normally animation android不要正常缩放动画android
【发布时间】:2014-01-03 06:33:15
【问题描述】:

我想创建一个像这样的动画: 它从左下角缩放到右上角。

到目前为止,这是我的代码:

<set xmlns:android="http://schemas.android.com/apk/res/android" >

<scale
    android:duration="500"
    android:fillAfter="true"
    android:fromXScale="0.0"
    android:fromYScale="1.0"
    android:toXScale="1.0"
    android:toYScale="1.0"
    >
</scale>

</set>

是否有一些关于如何制作动画的教程?我理解这个概念,但我不知道所有变量,例如 pivotX 和 pivotY。

【问题讨论】:

    标签: android scale android-animation


    【解决方案1】:

    【讨论】:

      【解决方案2】:

      在这里我将动画设置为图像 在 res 目录中创建名为 anim 的新文件夹并保存动画 xml

      使用AnimationUtils.loadAnimation(this, R.anim.xmlname);

      private Animation animFadeIn;
      ImageView image;
       public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
      image = (ImageView)findViewById(R.id.my_image);
      animFadeIn = AnimationUtils.loadAnimation(this, R.anim.xmlname);
      image.startAnimation(animFadeIn);
      

      【讨论】:

        【解决方案3】:

        我所做的是使用 pivotX 和 pivotY :

        <scale
            android:duration="300"
            android:fillAfter="true"
            android:fromXScale="0.0"
            android:fromYScale="0.0"
            android:toXScale="1.0"
            android:toYScale="1.0"
            android:pivotX="0%"
            android:pivotY="100%"
            >
        </scale>
        

        轴心是动画的起点。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2017-03-09
          • 2012-09-26
          • 1970-01-01
          • 2015-07-06
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多