长按时摇动图标[编辑模式]
我有一个带有一些 ImageButtons 的 Android 应用程序,就像图标一样。
我想知道如何实现用户长按图标后“摇动”图标的功能。就像编辑模式下的 iPhone 图标一样,你知道吗?
编辑完成后,图标不再晃动。
在 Android 中可以这样做吗?
I have an Android application with some ImageButtons, just like icons.
I would like to know how I could implement a function to "shake" icons after user long-presses them. Like iPhone icons on edit mode, you know?
After editing, icons stop shaking.
Is it possible to do that in Android?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用它可以在长按按钮事件时在图标上启动摇动动画
此片段取自此处的 android API 演示 http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Animation1.html
use this to start the shaking animation on your icons upon the long press event of your button
This snippet is taking from the android API Demo here http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Animation1.html
尝试在按钮上使用 TranslateAnimation(和/或 AnimationSet)。
像这样的东西:
请注意,此示例仅适用于向左摇动
Try to use TranslateAnimation (And/Or AnimationSet) on the button.
something like this:
notice that this example is only for shake to left