在Android中同时放大和缩小

问题描述:

我希望我的图像通过点击进行动画处理,比如它应该先缩小然后放大几分之一秒,然后放大操作发生图像应该消失。如何执行该操作。在Android中同时放大和缩小

+0

欢迎#1。请显示您的代码,以证明您尝试了多远,并帮助其他成员更好地理解您的问题,同时提供您的问题背景。 https://stackoverflow.com/help/how-to-ask –

项目

您res目录中创建一个动画文件夹,并创建内部的

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


     <!-- zoom in animation  --> 
     <scale 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:duration="100" 
      android:fromXScale="1" 
      android:fromYScale="1" 
      android:pivotX="50%" 
      android:pivotY="50%" 
      android:toXScale="3" 
      android:toYScale="3" > 
     </scale> 

<!-- zoom out animation  --> 
    <scale xmlns:android="http://schemas.android.com/apk/res/android"> 
     android:duration="200" 
     android:fromXScale="1.0" 
     android:fromYScale="1.0" 
     android:pivotX="50%" 
     android:pivotY="50%" 
     android:toXScale="0.5" 
     android:toYScale="0.5" > 
    </scale> 
    </set> 

,你可以在不同的个XML使用和处理程序调用它们,或者您可以使用它们像一个阿尼姆XML 这种活性

,你需要调用这个 globbaly

动画zoomoutandzoomin;

和OnCreate中 zoomoutandfade内部=

AnimationUtils.loadAnimation(Splash.this,R.anim.fade_zoomoutandin);

按钮点击

ivpawfour.startAnimation(zoomoutandzoomin);

或发现这个线程[Android imageView Zoom-in and Zoom-Out

+0

图像变焦是否可以执行动画,如填充屏幕和消失图像? –

+0

雅放大为150%,并设置阿尔法它然后它会消失 –

+0

可以给我的完整代码 –