如何在Android上获取ImageView的Drawable的矩形? [英] How to get the rectangle of the Drawable of ImageView on Android?
本文介绍了如何在Android上获取ImageView的Drawable的矩形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取将包装ImageView的Drawable的矩形对象,而不是将包装ImageView的矩形的对象.我将使用该矩形在Drawable周围绘制一些奇特的矩形.如何获得该矩形?
I want to get the rectangle object that will wrap the Drawable of ImageView instead of the rectangle that will wrap the ImageView. I will use that rectangle to draw some fancy rectangle around Drawable. How can I get that rectangle?
推荐答案
Rect rect = new Rect();
ImageView iV = new ImageView();
rect.left = iV.getLeft();
rect.top = iV.getTop();
rect.bottom = iV.getBottom();
rect.right = iV.getRight();
现在您有了矩形.
这篇关于如何在Android上获取ImageView的Drawable的矩形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文