2
我一直試圖讓它使用這個線程工作,但似乎無法得到它的工作。框架動畫幫助Android
我試圖讓兩個佈局之間的屏幕交替,我已經試過很多從狀態列表可繪製不同的東西,塑造可繪,甚至flipViews(flipViews沒有工作,因爲你不能改變背景,只是前景)。
現在我得到一個空指針。如果您想指出我無法在動畫中使用佈局,那麼請這樣做,因爲這可能是問題,但我無法確定。 任何解決方案,以達到我的最終目標,表示讚賞。
我的onCreate包含以下(減去標準的東西)
ImageView mainimage = (ImageView) findViewById(R.id.main);
mainimage.setBackgroundResource(R.anim.blink);
AnimationDrawable blinkAnimation = (AnimationDrawable) mainimage.getBackground();
blinkAnimation.start();
我的動畫文件包含此:(減去UTF東西)
<
animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/royalblue" android:duration="200" />
<item android:drawable="@drawable/blank" android:duration="200" />
</animation-list>
圖像視圖中的主要是絕對的牛逼這個空白的xml文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
這是我放置在繪製文件夾中的佈局,因爲我想它是在動畫幀。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/blinkBlue"
android:background="@color/royalBlue"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
這是其他佈局我已放置在抽拉文件夾,因爲我希望它是在動畫的幀。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/blinkBlack"
android:background="@color/black"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
具有u解決了這個問題還是仍在尋找答案? – 2011-11-19 09:43:58
使用AnimationDrawable時,您可以輕鬆地耗盡內存。我想出了一個用drawables來顯示動畫的類:http://stackoverflow.com/a/12519216/525319 – Yar 2012-09-20 19:11:58