Wednesday 15 September 2010

Animation list drawable as ImageView drawable source on Android 5 -



Animation list drawable as ImageView drawable source on Android 5 -

is there specific reason why next animation not play when set drawable source of image view under android 5?

<?xml version="1.0" encoding="utf-8"?> <animation-list android:oneshot="false" xmlns:android="http://schemas.android.com/apk/res/android"> <item android:duration="750" android:drawable="@drawable/ic_status_battery_0" /> <item android:duration="750" android:drawable="@drawable/ic_status_battery_1" /> <item android:duration="750" android:drawable="@drawable/ic_status_battery_2" /> <item android:duration="750" android:drawable="@drawable/ic_status_battery_full" /> </animation-list>

works on android 4.4.

okay, seems animationdrawable objects embedded within levellistdrawable objects, there next way on android 5:

levellistdrawable lld = (levellistdrawable) imageview.getdrawable(); drawable current = lld.getcurrent(); if(current instanceof animationdrawable) { ((animationdrawable)current).start(); }

android android-animation android-imageview

No comments:

Post a Comment