我有一個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