I'm using a pinch and zoom function on an ImageView that calls view.setImageMatrix(matrix)
. The problem is that I also want to call onSizeChanged
for this ImageView
and this function never seems to get called after the image is zoomed or reduced in size. Is the onDraw() and onSizeChanged() ever called after setImageMatrix is set? I want to be able to access this method:
class MyImageView extends ImageView {
@Override
protected void onSizeChanged(int xNew, int yNew, int xOld, int yOld)
{
super.onSizeChanged(xNew, yNew, xOld, yOld);
parent = (View) this.getParent();
ViewGroup.LayoutParams params = (ViewGroup.LayoutParams) parent.getLayoutParams();
params.height = yNew;
params.width = xNew;
parent.setLayoutParams(params);
if (parent.getParent() != null) {
if (parent.getParent() instanceof ScrollView) {
((ScrollView) parent.getParent()).smoothScrollBy(xNew,yNew);
((ScrollView) parent.getParent()).setSmoothScrollingEnabled(true);
((ScrollView) parent.getParent()).fullScroll(View.FOCUS_DOWN);
}
}
}
}