Android PhotoView SetDisplayMatrix
I am using https://github.com/chrisbanes/PhotoView and trying to top crop it using setDisplayMatrix method. Based on issue: https://github.com/chrisbanes/PhotoView/issues/185 It sh
Solution 1:
Extending the default PhotoView
and overriding setImageDrawable
did the trick for me.
@Override
public void setImageDrawable(Drawable drawable) {
super.setImageDrawable(drawable);
Matrix m = getDisplayMatrix();
float[] values = new float[9];
m.getValues(values);
if (values[5] < 0.0f) {
m.postTranslate(0, -2 * values[5]);
setDisplayMatrix(m);
}
}
Post a Comment for "Android PhotoView SetDisplayMatrix"