本文介绍了如何旋转绘制由ObjectAnimator?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Alphaing一个绘制工作做好是这样的:

Alphaing a drawable work well like this:

if(mAlphaAnimation == null){
        mAlphaAnimation = ObjectAnimator.ofFloat(this, "alpha", 0.0f,1.0f).setDuration(TARGET_ANIM_ALPHA_DURATION);
        mAlphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
        mAlphaAnimation.setStartDelay(TARGET_ANIM_ALPHA_DELAY_BASE*power);
        mAlphaAnimation.setRepeatCount(ValueAnimator.INFINITE);
        mAlphaAnimation.setRepeatMode(ValueAnimator.REVERSE);
        mAlphaAnimation.addUpdateListener(this);
 }

但是,如果我想旋转象下面这样被拉伸,这唐的工作。

But if I want rotate a drawable like below , it don's work.

private void createRotateAnim(float fromDegress,float toDegress,int duration){
    if(mRotateAnimation == null){
        mRotateAnimation = ObjectAnimator.ofFloat(this, "rotation",fromDegress,toDegress).setDuration(duration);
        mRotateAnimation.setStartDelay(100);
        mRotateAnimation.setInterpolator(new AccelerateInterpolator());
        mRotateAnimation.addUpdateListener(this);
    }
}

任何人都可以帮我解决这个问题,或者这些是任何其他方式来创建一个旋转绘制动画。

Anyone can help me to fix this issue, or these is any other way to create a rotation drawable animation .

我很抱歉,我的英语很差。

I am sorry to my poor English.

推荐答案

试试这个简单的旋转动画应用到图像。

Try this simple Rotation Animation applied to a image.

 ImageView imageview = (ImageView)findViewById(R.id.myimage);
 RotateAnimation rotate = new RotateAnimation(180, 360, Animation.RELATIVE_TO_SELF,
 0.5f,  Animation.RELATIVE_TO_SELF, 0.5f);
  rotate.setDuration(500);
 imageview.startAnimation(rotate);

这篇关于如何旋转绘制由ObjectAnimator?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 13:29