android matrix 最全方法详解与进阶(完整篇)
代码语言:javascript复制imageView = findViewById(R.id.imageview);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Drawable drawable = imageView.getDrawable();
Matrix matrix = imageView.getImageMatrix();
if (drawable != null) {
RectF rectf = new RectF();
rectf.set(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
matrix.mapRect(rectf); //最关键的一句
Log.i("lcf", "left " rectf.left " " rectf.top " " rectf.right " " rectf.bottom);
}
}