-4

I have sequence of images, based on the touch or swipe of screen i need to change these images to provide a 360 rotation feel.. eg if there is single touch based on the touch gesture i will change a single image.. For swipe i am using matrix and touch gesture to calculate the swipe distance and based on the distance calculated, change the images... Is there any API that can preform all these..

1 Answers1

2

Assuming you have an imageView use Matrix for rotation

Matrix matrix = new Matrix();
imageView.setScaleType(ImageView.ScaleType.MATRIX);   //required
matrix.postRotate( angleValue, imageView.getDrawable().getBounds().width()/2, imageView.getDrawable().getBounds().height()/2);
imageView.setImageMatrix(matrix);
Ahsan Kamal
  • 1,085
  • 2
  • 13
  • 34
  • Thanks AkSiddique and Ait Vaghela.. I waned to slightly modify the question.. I have sequence of images based on the touch of the screen i need to change these images. eg if there is single touch on left side based on the touch gesture i will change the image. I wanted to know if there is any api for this else i need to write a separate logic for single touch, double touch and change of images based on the gesture. – S.SunilKumar Feb 11 '16 at 07:16
  • @S.SunilKumar, you have to write your own logic for this. **P.S** To rotate an ImageView on ontouch at runtime you can set onTouchListener on ImageView & rotate it by adding last two lines(i.e. postRotate matrix & set it on imageView) in above code section in your touch listener ACTION_MOVE part. – Ahsan Kamal Feb 11 '16 at 07:34