Android 图片自动放大/缩小循环执行

    private void addAnimation(){
        img_show.startAnimation(scaleAnimation());				
       // img_show.clearAnimation(); //停止动画
    }
    /**
     * 图片自动循环缩放
     * @return
     */
    public static ScaleAnimation scaleAnimation() {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.5f, 1.0f, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);

        scaleAnimation.setDuration(900);                        //动画执行时间
        scaleAnimation.setRepeatCount(-1);                    //-1表示重复执行动画
        scaleAnimation.setRepeatMode(Animation.REVERSE);    //重复 缩小和放大效果
        return scaleAnimation;
    }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章