6

I'm looking for a way to implement image zoom and scrolling the way it is implemented in Droid Comic Viewer. Is there any quick way to do that? If not, then could you please give some advices at least on implementing kinetic scrolling.

F0RR
  • 1,590
  • 4
  • 16
  • 30

2 Answers2

9

It wasn't quick for us. When we implemented that part of Droid Comic Viewer we used the source code of ScrollView as reference to create a view able to handle horizontal and vertical scrolling.

Scrolling and zooming have a lot of quirks that we gradually solved, and some of them that we still have to solve.

If you're not in a hurry, we plan to release the source code later this year.

hpique
  • 119,096
  • 131
  • 338
  • 476
  • 1
    I'm attempting the same thing. Any updates on that source code? – GPSmaster Apr 27 '11 at 09:08
  • I have an open source ImageView component that provides pinch-zoom and panning etc (similar to iPhone), and is open source: https://github.com/jasonpolites/gesture-imageview – Jason Polites May 13 '12 at 05:20
4

There are many ways to implement zoom. As easy way is to set an image matrix on the ImageView:

Matrix matrix = new Matrix();
matrix.postScale(scaleX, scaleX);
matrix.postTranslate(offsetX, offsetY);
mImageView.setImageMatrix(matrix);

If you're not familiar with touch event processing, look into OnTouchListener. Using a GestureDetector can help simplify things further.

James
  • 841
  • 4
  • 5
  • Yeah, that I've already found here: http://stackoverflow.com/questions/937313/android-basic-gesture-detection But I still look for some good explanations on kinetic scrolling implementation on android. – F0RR Jan 07 '10 at 21:01