使用 ImageView 制作图像动画

发布于 2024-12-13 07:43:27 字数 102 浏览 4 评论 0原文

我对 Android 编程还很陌生,我环顾四周但未能找到明确的答案。我需要通过将图像与另一个图像(例如精灵)切换来慢慢地为图像添加动画效果。如果有人可以提供帮助,那么看起来应该很简单。谢谢!

I'm pretty new to Android programming, and I've looked around but haven't been able to find a clear-cut answer. I need to slowly animate an image by switching it with anothe, like a sprite. If anyone can help, it seems like it should be really simple. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暮色兮凉城 2024-12-20 07:43:27

您可能想要使用 TransitionDrawable
http://developer.android.com/reference/android/graphics/drawable /TransitionDrawable.html

Drawable[] layers = new Drawable[2];
layers[0] = //your first drawable
layers[1] = //your second drawable
TransitionDrawable transition = new TransitionDrawable(layers);
myImageView.setImageDrawable(transition);
transition.startTransition(1500);

You'll probably want to use a TransitionDrawable
http://developer.android.com/reference/android/graphics/drawable/TransitionDrawable.html

Drawable[] layers = new Drawable[2];
layers[0] = //your first drawable
layers[1] = //your second drawable
TransitionDrawable transition = new TransitionDrawable(layers);
myImageView.setImageDrawable(transition);
transition.startTransition(1500);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文