Reputation: 955
I have an imageview and I want to make sure that when the user touches it to rotate it i.e on the call of ontouch event , the user should not be able to move it more than an angle of 90 degree . i.e to limit its rotation to max 90 degree.
Any suggestions
Upvotes: 0
Views: 444
Reputation: 9167
ImageView does not setRotation. I guess that would have made the lyout managements too complex. You could write your own extended version of ImageView (RotatedImageView?).
The idea is to override the onDraw method with something like this (not tested).
@Override
public void onDraw(Canvas canvas) {
canvas.rotate((int)(angle * 180 / Math.PI), getWidth() >> 1, getHeight() >> 1);
super.onDraw(canvas);
}
Upvotes: 1