3
我有一些動畫圖像(幀),如IMAGE_1,IMAGE_2和image_3.I的希望在我的應用程序中使用這個動畫形象,所以我嘗試如何在android中製作隨機幀動畫?
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false" >
<item
android:drawable="@drawable/image_1"
android:duration="2000"/>
<item
android:drawable="@drawable/image_2"
android:duration="50"/>
<item
android:drawable="@drawable/image_3"
android:duration="50"/>
</animation-list>
並將此作爲我的佈局的背景
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(hasFocus){
final AnimationDrawable bgDrawable = (AnimationDrawable) ((LinearLayout) findViewById(R.id.animationLayout))
.getBackground();
((LinearLayout) findViewById(R.id.animationLayout))
.post(new Runnable() {
@Override
public void run() {
bgDrawable .start();
}
});
}
}
}
但是這顯示動畫每次以相同的順序重複。我想通過使用這些圖像來製作random frame animation
。我該如何做到這一點?
由於提前
但是這顯示圖像幀在每次相同的順序 – 2013-05-09 09:48:44
@DevuSoman,你得開玩笑吧。只要改變線條的順序即可。 '1。第二幀「,」2。第三幀「,」3。第一幀「 – 2013-05-09 09:51:12
我問你如何通過改變幀的順序在特定的時間間隔後重復動畫 – 2013-05-09 09:57:59