1
votes

I tried many examples of how to zoom and pan Views. All they work with different views, imageViews. However I could not find any solution for panning zoomed TextureView. Is there anyone who implemented that feature?

1
TextureView#setTransform(Matrix transform)pskink
@pskink It is only for zooming not panningShuhrat Akramov
no, it is for everything a Matrix supportspskink
Yes. It really works like that. ThanksShuhrat Akramov

1 Answers

2
votes

In simple views like ImageView in many implementations canvas is used. Instead of canvas in views whose onDraw() method is final use Matrix. Example:

On ImageView:

 canvas.translate(x, y);
 canvas.scale(mScaleFactor, mScaleFactor);

On TextureView:

 matrix.postTranslate(x, y);
 matrix.postScale(mScaleFactor, mScaleFactor);

Example in github: link