有没有办法对一个家庭的Widget动画? [英] Is there a way to animate on a Home Widget?

查看:90
本文介绍了有没有办法对一个家庭的Widget动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在主页窗口小部件,即一个AppWidgetProvider上使用的动画。我希望用帧动画技术:

I want to use an animation on a Home page Widget, i.e. an AppWidgetProvider. I was hoping to use the "Frame Animation" technique:

<一个href="http://developer.android.com/guide/topics/graphics/2d-graphics.html#frame-animation">http://developer.android.com/guide/topics/graphics/2d-graphics.html#frame-animation

我在一个活动成功地使用过。但我不能把这种code到AppWidgetProvider。

which I've used successfully in an activity. But I can't translate that code to an AppWidgetProvider.

基本上,在AppWidgetProvider,创建工作与RemoteViews对象,其中AFAIK不为我提供一个方法来获得引用到的ImageView的布局我打电话启动()的动画。还有没有处理程序或回调,当插件播放这样我就可以做的start()调用的。

Basically, in an AppWidgetProvider, I create and work with a RemoteViews object, which AFAIK doesn't provide me with a method to get a reference to an ImageView in the layout for me to call start() on the animation. There is also not a handler or a callback for when the widget displays so I can make the start() call.

有另一种方法可以做到这一点?我想,我也许可以做我自己的动画非常快的OnUpdate()调用上的小部件,但似乎非常昂贵的。

Is there another way this can be done? I suppose that I can probably do the animation on my own with very fast onUpdate() calls on the widget, but that seems awfully expensive.

推荐答案

我目前正在创建一个窗口小部件需要精灵动画,我已经把如何的动画家里部件。是的,它是昂贵的事,所以我只在需要的部件。顺便说一句,原生Android的动画没有在远程视图支持。

I am currently creating an widget that "need" sprite animation, and I have put a blog post on how to animate home widget. Yes, it is expensive to do, so I do it only when the widget is needed. BTW, original android animation is not supported in remote views.

编辑:

演示项目已启动。

这篇关于有没有办法对一个家庭的Widget动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆