是否可以在动态壁纸中使用 Android 的视图动画包(补间/帧)?
问候各位机器人头之类的人。我正在开发一个越来越复杂的动态壁纸项目。我很好奇:有没有人找到一种方法在动态壁纸中使用 Android 的视图动画包(http://developer.android.com/guide/topics/graphics/view-animation.html)?对我来说,这似乎并不明显,因为它是一项服务而不是一项活动,并且您被给予一个表面持有者来锁定以获取可以在其上绘制的画布 - 无法设置ContentView等。 tween 包似乎依赖于视图(即动画与视图本身相关联,而不是画布、位图等)。有什么想法吗?提前致谢。乔治
Greetings fellow Droidheads and the like. I am working on a Live Wallpaper project that's getting more complex. I am curious: has anyone figured out a way to use Android's View Animation package (http://developer.android.com/guide/topics/graphics/view-animation.html) from within live wallpaper? It doesn't seem obvious to me that this is possible, in that it is a service rather than an activity, and you are given a surfaceholder to lockdown to get a canvas on which to draw--no way to setContentView, etc. The tween package seems to depend on views (i.e. the animation gets associated with the view itself, not the canvas, bitmap, etc.). Any thoughts? Thanks in advance. George
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我构建了一个库,可以让您对任何 Java 对象进行插值和动画处理,并针对 Android 进行了优化(无需任何垃圾回收)。
由于我不是在这里宣传产品(它是一个开源库,LGPL),因此我鼓励您阅读我在此线程中的答案:
Android:位图的补间动画
告诉我它是否解决了您的问题:-)
I built a library that let you interpolate and animate any Java object, optimized for Android (without any garbage collection).
Since I'm not here to publicize a product (it's an open source lib, LGPL), I would encourage you to read my answer in this thread:
Android: tween animation of a bitmap
Tell me if it solves your problem :-)
努力回答我自己的问题......
不,我认为这是不可能的。
我已经努力尝试过,但没有成功,并且我查看了很多其他人代码的示例,但从未见过有人采取这种方法。
更重要的是,即使它有效,我现在认为这也不是一个好主意:动态壁纸最好对自己的绘图负责,精确控制时序问题等等。
乔治
Endeavoring to answer my own question...
No, I do not think this is possible.
I have tried hard, with no success, and I have reviewed many examples of other people's code, and never seen anyone take this approach.
What's more, even if it worked, I now think it wouldn't be a good idea: it's better for live wallpapers to take responsibility for their own drawing, to precisely control timing issues, &c.
George