U可以使用烏爾目的此方法。方法是returnig Rect obj.from你可以得到圖像的高度寬度,你可以先將高度設置爲imageview,然後應用下載代碼。
private Rect getBitmapBounds(Uri uri) {
Rect bounds = new Rect();
InputStream is = null;
try {
is = context.getContentResolver().openInputStream(uri);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeStream(is, null, options);
bounds.right = options.outWidth;
bounds.bottom = options.outHeight;
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
closeStream(is);
}
return bounds;
}
對於下載圖像此鏈接有一些方法以及.. Follow the link
可以複製? http://stackoverflow.com/questions/16909591/universal-image-loader-get-original-image-size – muetzenflo
我不認爲這是我想要的。我想在**圖片加載前將尺寸設置爲我的ImageView **,**不** ** onLoadingComplete' –