Android如何使用矩阵获取imageview的边界 [英] Android how to get bounds of imageview with matrix

查看:75
本文介绍了Android如何使用矩阵获取imageview的边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将scaletype设置为矩阵的ImageView,并希望在矩阵转换后获得带有图像边界的Rect.

I have an ImageView with scaletype set to matrix, and would like to get a Rect with the bounds of the image after the transformation of the matrix.

我怎么得到这样的直肠?谢谢.

How do I get such a rect? thanks.

推荐答案

ImageView imageView = (ImageView)findViewById(R.id.imageview);
Drawable drawable = imageView.getDrawable();
Rect imageBounds = drawable.getBounds();

然后使用Matrix.mapRect.

Then use Matrix.mapRect.

这篇关于Android如何使用矩阵获取imageview的边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆