【发布时间】:2014-11-11 02:01:56
【问题描述】:
最近我写了一个函数。它是关于每个列表项中的刷新按钮。我想要的是单击按钮或列表项,刷新按钮开始旋转。请求完成时停止。 我使用动画如下:
<?xml version="1.0" encoding="UTF-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:fillAfter="true"
android:fromDegrees="0"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:toDegrees="358" />
还有一些源代码在这里:
public void refresh(View v) {
Animation rotation = AnimationUtils.loadAnimation(mContext,
R.anim.rotate);
rotation.setFillAfter(true);
v.startAnimation(rotation);
}
public void completeRefresh(View v) {
v.clearAnimation();
}
请求完成后,我调用 notifyDataSetChanged() 来刷新 LiseView。
问题是按钮确实在旋转。但是当我第二次点击它时。它在旋转,但有点模糊。就像这样:
有什么建议吗?非常感谢。
【问题讨论】:
-
我用谷歌搜索的所有方法都试过了。但没有任何效果...
-
我想你可以在这里使用 GIF 图片。这对你会更好。
-
最后我发现当我删除谷歌广告横幅时。它就像一个魅力。我还没有时间确切地知道原因。我们去看看吧。
标签: android listview rotation imagebutton rotateanimation