Rich image scroll and zooming on android

后端 未结 2 2018
暖寄归人
暖寄归人 2020-12-28 23:54

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 pleas

2条回答
  •  隐瞒了意图╮
    2020-12-29 00:18

    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.

提交回复
热议问题