How to get the rectangle of the Drawable of ImageView on Android?
问题 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? 回答1: Rect rect = new Rect(); ImageView iV = new ImageView(); rect.left = iV.getLeft(); rect.top = iV.getTop(); rect.bottom = iV.getBottom(); rect.right = iV.getRight(); Now you have your rectangle. 回答2: You can use getImageMatrix() See: Android how to get bounds