Image click after animation

社会主义新天地 提交于 2020-01-06 03:00:06

问题


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

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.


回答1:


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.

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



来源:https://stackoverflow.com/questions/10532972/image-click-after-animation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!