开发者

Animate drawableLeft APNG in button?

I'm trying to add an animated PNG to a Button as a drawableLeft.

Basically, the button begins its life disabled and unclickable with animated PNG of a 16x16 indeterminate progress icon.

  • If I can grab a cached location from the GPS, the button becomes enabled & c开发者_运维知识库lickable and has its text set to the latitude & longitude I was able to grab from the cache.

  • Once the GPS gets a lock, the animated icon gets replaced by a checkmark, the button becomes enabled & clickable (if it wasn't already), and the button's Text gets set to the new latitude & longitude.

The idea is that the user can be impatient and click the button immediately to accept the cached value, or stick around and wait for a better value to appear.

So much for the theory. I tried it with an APNG that I know beyond doubt to be valid (the bouncing beachball from the APNG wikipedia article), as well as several other APNG images, but none of them animate when I embed them in the button.

Is this even possible? Do I somehow need to trigger the animation? If so, how?


APNG format is not currently supported. An issue was opened and declined with google asking for support http://code.google.com/p/android/issues/detail?id=7743. And there is a second open issue requesting support http://code.google.com/p/android/issues/detail?q=apng&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&id=10273

I wouldn't anticipate this being added any time soon.

I would look into using an AnimationDrawable for what you want to do http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜