Android 动画导致AsyncTask HttpClient任务超慢
我在AsyncTask中定义了一个网络任务,该任务大约需要2-3秒才能完成 当我在下面添加动画代码时:Android 动画导致AsyncTask HttpClient任务超慢,android,Android,我在AsyncTask中定义了一个网络任务,该任务大约需要2-3秒才能完成 当我在下面添加动画代码时: <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:duration="60"
android:interpolator="@android:anim/linear_interpolator" />
网络呼叫大约需要12-13秒才能完成。我是不是做错了什么?我想问题是持续时间的值,它是以毫秒为单位指定的,我猜您希望它更像6000或60000(1分钟) 该值太小可能会导致UI线程备份大量帧更新,从而延迟它处理异步任务中的onProgressUpdate和onPostExecute代码
尝试将持续时间设置为更大的值。似乎这就是问题所在。谢谢
progressImageView = (ImageView) getWindow().findViewById(
R.id.progressImageView);
progressAnimation = AnimationUtils.loadAnimation(this, R.anim.progress);
progressImageView.startAnimation(progressAnimation);