Java tutorial
//package com.java2s; import android.view.View; import android.view.animation.Animation; import android.view.animation.ScaleAnimation; public class Main { private static final float SCALE_DOWN_VALUE = 0.96f; private static final long SCALE_ANI_DURATION = 40; private static void scaleDownAni(View v) { /*if(scaleDownAni == null){ scaleDownAni = new ScaleAnimation(1.0f, SCALE_DOWN_VALUE, 1.0f, SCALE_DOWN_VALUE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleDownAni.setDuration(SCALE_ANI_DURATION); scaleDownAni.setFillAfter(true); }*/ ScaleAnimation scaleDownAni = new ScaleAnimation(1.0f, SCALE_DOWN_VALUE, 1.0f, SCALE_DOWN_VALUE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleDownAni.setDuration(SCALE_ANI_DURATION); scaleDownAni.setFillAfter(true); //v.startAnimation(scaleDownAni); //v.setAnimation(scaleDownAni); //scaleDownAni.startNow(); v.startAnimation(scaleDownAni); /*v.animate().scaleX(SCALE_DOWN_VALUE); v.animate().scaleY(SCALE_DOWN_VALUE); v.animate().setDuration(SCALE_ANI_DURATION); v.animate().start();*/ //v.setScaleX(SCALE_DOWN_VALUE); //v.setScaleY(SCALE_DOWN_VALUE); } }