Roland
Roland

Reputation: 7863

Why does ImageView.setImageMatrix() not work?

I want to rotate an image using ImageView.setImageMatrix(matrix) but it simply doesn't have any effect. I call matrix.postRotate(45, 20, 20); before passing it to the function above but no effect, the image is not rotated. Why?

matrix.postRotate(45, 20, 20);
ImageView.setImageMatrix(matrix)

Upvotes: 25

Views: 20915

Answers (1)

bigstones
bigstones

Reputation: 15267

I'm not really sure but I think you should set scale type:

imgView.setScaleType(ScaleType.MATRIX);

You can also do that in XML with android:scaleType="matrix".

Upvotes: 76

Related Questions