我有一个RelativeLayout
,它存储五个ImageView
,它们每个都包含一个云的图像。所有图像的大小不同,最小的是582 * 182,最大的是700 * 400。包含云的区域的大小是860 * 1080。
在屏幕的顶部是我想要加载到我的服务器上的图像,下面是上述的RelativeLayout
。当用户落在该屏幕上时,云开始移动。问题在于整个动画效果不佳(我试图在HTC One上运行它)。 我的动画描述如下图所示:大屏幕尺寸的动画延迟
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fillEnabled="true"
android:fillAfter="true">
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="12000"
android:toXDelta="-12%p"
android:repeatCount="infinite"
android:repeatMode="reverse"/>
</set>
的ImageView
s的描述,像这样:
<ImageView
android:id="@+id/clouds_image_view_cloud2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="cloud 2"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"/>
我开始它象下面这样:
Animation animRToL = AnimationUtils.loadAnimation(mContext, R.anim.right_to_left);
Animation animLToR = AnimationUtils.loadAnimation(mContext, R.anim.left_to_right);
mClouds[0].startAnimation(animRToL);
mClouds[2].startAnimation(animRToL);
mClouds[1].startAnimation(animLToR);
mClouds[3].startAnimation(animLToR);
mClouds[4].startAnimation(animRToL);
我检查硬件加速条件通过mClouds[0].isHardwareAccelerated()
- 启用。我试图通过加载RGB_565
格式来降低BitMap的大小 - 没有运气。有什么我可以做的这个滞后?
P.S.相同图像的动画在iPhone 4
上运行的应用程序版本iOS
没有任何滞后。
UPD:我注意到,动画流畅运行,如果我减少5被动画到4
您是否找到了解决方案?我遇到了类似的情况。 – Jerome
@Jerome不幸的是,我们决定不在android上使用这样的动画。 – aga