问题
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:
Animation
s 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