private void displayImg(ImageView p_w_picpathView, String url) { RequestQueue mQueue = Volley.newRequestQueue(context); ImageLoader p_w_picpathLoader = new ImageLoader(mQueue, new BitmapCache()); ImageLoader.ImageListener listener = ImageLoader.getImageListener(p_w_picpathView, R.mipmap.ic_launcher, R.mipmap.ic_launcher); p_w_picpathLoader.get(url, listener); //指定图片允许的最大宽度和高度// p_w_picpathLoader.get("http://developer.android.com/p_w_picpaths/home/aw_dac.png",listener, 200, 200); } public class BitmapCache implements ImageLoader.ImageCache { private LruCachecache; public BitmapCache() { cache = new LruCache (10 * 1024 * 1024) { @Override protected int sizeOf(String key, Bitmap bitmap) { return bitmap.getRowBytes() * bitmap.getHeight(); } }; } @Override public Bitmap getBitmap(String url) { return cache.get(url); } @Override public void putBitmap(String url, Bitmap bitmap) { cache.put(url, bitmap); } }