Yarh
Yarh

Reputation: 4607

How to find translation of ImageView?

I drag Image view in following way.

matrix.postTranslate(a,b);
ImageView.setImageMatrix(matrix);

I want to find values a and b. I can get ImageView.getImageMatrix, but how to find translated way?

Upvotes: 0

Views: 253

Answers (1)

andy256
andy256

Reputation: 2881

Use

float[] values = new float[9];
matrix.getValues(values);

The values array will now hold the translation floats. The x translation is

values[Matrix.MTRANS_X]

The y translation is

values[Matrix.MTRANS_Y]

Upvotes: 2

Related Questions