如何code的刷新图标动画 [英] How to code an animation for refresh icon
问题描述
问题在眼前:
我目前正在为code的刷新图标,到目前为止的动画功能,通过研究,我只是设法采购此code片断出来:
I am currently trying to code an animation function for the refresh icon and so far, through research I have only managed to source this code snippet out:
LayoutInflater inflater= (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ImageView iv= (ImageView) inflater.inflate(R.layout.spin_refresh, null);
Animation rotation= AnimationUtils.loadAnimation(DownloadService.this,R.anim.accelerate_decelerate_interpolator);
rotation.setRepeatCount(Animation.INFINITE);
iv.startAnimation(rotation);
refreshItem.setActionView(iv);
//TODO trigger loading
我不能真正完全融为一体prehend的编码,是否有动画编码或什么的更简单的方法是在code本身的一般含义。我已经在res文件夹中创建动画文件夹中的一个单独animation.xml。
I couldn't actually fully comprehend the codings, are there any simpler way of animation coding or what's the general meaning of the code itself. I have already created a separate animation.xml within the animation folder in res folder.
推荐答案
我猜你需要旋转图像,以自我像<一个href=\"http://stackoverflow.com/questions/17345041/move-image-from-left-to-right-then-rotate-animation\">second动画在这个岗位
I guess you need to rotate the image to self like second animation in this post
您可以使用此:
image.clearAnimation();
RotateAnimation anim = new RotateAnimation(30, 360, image.getWidth()/2, image.getHeight()/2);
anim.setFillAfter(true);
anim.setRepeatCount(0);
anim.setDuration(10000);
image.startAnimation(anim);
希望这有助于。
这篇关于如何code的刷新图标动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!