如何让我的图像抖动/摆动单击时? [英] How do I make an image shake/wiggle when clicked?

查看:134
本文介绍了如何让我的图像抖动/摆动单击时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我想会抖动/摆动当它触及的ImageButton。我想它类似于iPhone应用程序图标的方式来扭动做的时候都pssed了很长一段时间$ P $。

I have an imagebutton that I would like to make shake/wiggle when it is touched. I would like it to wiggle in a manner similar to iPhone app icons do when they are pressed for a very long time.

谢谢!

推荐答案

看看这个惊天的图像上ImageView的点击监听器。

Try this for shaking the image on imageview click listener.

 public void onClick(View v)
  {
    Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
    findViewById(R.id.pw).startAnimation(shake);
   }

请参阅该片段是从Android API演示<一走href="http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Animation1.html">here

See this snippet is taking from the android API Demo here

这篇关于如何让我的图像抖动/摆动单击时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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