【问题标题】:How to find translation of ImageView?如何找到 ImageView 的翻译?
【发布时间】:2013-07-16 13:43:39
【问题描述】:

我以以下方式拖动图像视图。

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

我想找到值 ab。我可以得到ImageView.getImageMatrix,但是如何找到翻译的方式?

【问题讨论】:

    标签: android matrix imageview


    【解决方案1】:

    使用

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

    values 数组现在将保存平移浮点数。 x 的翻译是

    values[Matrix.MTRANS_X]
    

    y 平移是

    values[Matrix.MTRANS_Y]
    

    【讨论】:

      猜你喜欢
      • 2014-10-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-07
      • 1970-01-01
      • 2015-07-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多