开发者

Rich image scroll and zooming on android

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, th开发者_JAVA百科en could you please give some advices at least on implementing kinetic scrolling.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜