Android how to get bounds of imageview with matrix

房东的猫 提交于 2019-12-07 13:58:02

问题


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.


回答1:


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

Then use Matrix.mapRect.



来源:https://stackoverflow.com/questions/8590693/android-how-to-get-bounds-of-imageview-with-matrix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!