/** * 下载图片-可指定显示图片的高宽 * * @param url * @param width * @param height */ private Bitmap downloadBitmap(String url, int width, int height) { Bitmap bitmap = null; try { // http加载图片 bitmap = ApiClient.getNetBitmap(url); if (width > 0 && height > 0) { // 指定显示图片的高宽 bitmap = Bitmap.createScaledBitmap(bitmap, width, height, true); } // 放入缓存 cache.put(url, new SoftReference<Bitmap>(bitmap)); } catch (AppException e) { e.printStackTrace(); } return bitmap; }