1
photo = (ImageView) findViewById(R.id.image1);
photo.setImageBitmap(pic);
Drawable drawable = photo.getDrawable();
imageBounds = drawable.getBounds();
int scaledHeight = imageBounds.height();
int scaledWidth = imageBounds.width();
此处scaledHeight & scaledWidth为零。但我正确地获得图像的大小。getBounds返回高度和宽度0
int intrinsicHeight = drawable.getIntrinsicHeight();
int intrinsicWidth = drawable.getIntrinsicWidth();
是什么问题imageBounds.height();
谢谢@Zappescu。这工作正常。但我期待的scaledHeight是屏幕上显示的图像的实际高度,这将始终小于屏幕高度(对于我320px)。但它与intrinsicHeight相同,即图像的实际大小。我也试过imageBounds.left。但它也返回了图像的实际大小。 – sandeep