Why does calling setScaleX during pinch zoom gesture cause flicker?
- by numan
I am trying to create a zoomable container and I am targeting API 14+
In my onScale (i am using the ScaleGestureDetector to detect pinch-zoom) I am doing something like this:
public boolean onScale (ScaleGestureDetector detector) {
float scaleFactor = detector.getScaleFactor();
setScaleX(getScaleX() * scaleFactor);
setScaleY(getScaleY() * scaleFactor);
return true;
};
It works but the zoom is not smooth. In fact it noticeably flickers.
I also tried it with hardware layer thinking that the scaling would happen on the GPU once the texture was uploaded and thus would be super fast. But it made no difference - the zoom is not smooth and flickers weirdly sometimes.
What am I doing wrong?