动画完成后,点击图片 [英] Image click after animation

查看:175
本文介绍了动画完成后,点击图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个奇怪的问题。我有我用绕一固定点的图像 rotateAnimation

I have this strange issue. I have an image which I rotate about a fixed point using rotateAnimation.

当用户点击图片我已经处理click事件,如下所示:

I have handled the click event when the user clicks the images as shown below:

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.imageView1:
        finish();
        Intent i = new Intent(this, Next.class);
        startActivity(i);
        break;
        }
}

我所面临的问题是,当我旋转图像,则不会触发点击事件,当我点击的形象,但是当我点击该图像是在第一次的位置被触发。

The problem I face is that, after I rotate the image, the click event is not triggered when I click the image, but is triggered when I click the position where the image was at first.

我知道我必须在这里失去了一些东西基本的,但我不明白。

I know I must be missing something basic here but I can't figure it out.

推荐答案

动画■不要使动画查看改变位置或大小。他们只表明这种转变不会影响任何的查看的属性。因此,您能看到的行为。

Animations do not cause the animating View to change position or size. They only show such transformations without affecting any of the properties of the View. Hence the behavior seen by you.

在你想真正移动的情况下/调整查看对象,实施 AnimationListener 和<执行操作code> onAnimationEnd 。

In case you want to actually move/resize the View object, implement AnimationListener and perform the operation on onAnimationEnd.

这篇关于动画完成后,点击图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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