[英]animation-list not working in Android 5.0 (Lollipop)
我需要一個簡單的動畫,顯示3點加載。 所以我創建了3個圖像,將其添加到動畫列表並將其設置為imageview。 它工作正常直到kitkat,但在將我的操作系統更新到Lollipop后,動畫似乎不起作用。
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false" >
<item
android:drawable="@drawable/one_dot"
android:duration="500"/>
<item
android:drawable="@drawable/two_dot"
android:duration="500"/>
<item
android:drawable="@drawable/three_dot"
android:duration="500"/>
</animation-list>
這是它如何設置為imageView
<ImageView
android:id="@+id/dotsLoadingView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/loadingText"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:src="@drawable/dots_loading" />
關於Android 5.0 Lollipop動畫有什么變化嗎?
從AnimationDrawable的文檔中,
創建逐幀動畫的最簡單方法是在XML文件中定義動畫,放置在
res/drawable/
文件夾中,並將其設置為View
對象的背景。 然后,調用start()
來運行動畫。
您需要調用start()
來運行動畫。
final ImageView myView = (ImageView) findViewById(R.id.dotsLoadingView);
((Animatable) myView.getDrawable()).start();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.