user967452
user967452

Reputation: 15

Android: My imageview is rotated, but its touch area isn't

I have a rectangular Imageview that responds to touch (it rotates by a specific number of degrees, using animation). The imageview has an ontouchlistener attached to it.

However, once it has rotated, it still responds to touch only at its original (pre-rotation) location. Even though I have setfillafter to true.

My theory is that the rotation is for display purposes only... is there a way to detect a touch on a rectangular imageview rotated at an angle - e.g. 45 degrees?

Upvotes: 1

Views: 558

Answers (1)

blessanm86
blessanm86

Reputation: 31779

When animation is applied to a view in android, only the pixels of the view are shifted while the hit area remains in the same position.

To actually move a view, you will need to add a animation listener to the view and manually change the view position on animation end.

Upvotes: 1

Related Questions