..
ImageView image = ImageView.class.cast(layout.findViewById(R.id...));
String url = "..."; // URL of the image
mImageLoader.get(url, new ImageListener() {
public void onErrorResponse(VolleyError arg0) {
image.setImageResource(R.drawable.icon_error); // set an error image if the download fails
}
public void onResponse(ImageContainer response, boolean arg1) {
if (response.getBitmap() != null) {
image.startAnimation(AnimationUtils.loadAnimation(container.getContext(), android.R.anim.fade_in));
image.setImageBitmap(response.getBitmap());
} else
image.setImageResource(R.drawable.icon_loading); // set the loading image while the download is in progress
}
});
당신은
mRequestQueue = Volley.newRequestQueue(context);
mImageLoader = new ImageLoader(mRequestQueue, new ImageLoader.ImageCache() {
private final LruCache<String, Bitmap> mCache = new LruCache<String, Bitmap>(10);
public void putBitmap(String url, Bitmap bitmap) {
mCache.put(url, bitmap);
}
public Bitmap getBitmap(String url) {
return mCache.get(url);
}
});'
당신이'서브 클래스 NetworkImageView' 및 인터페이스 등을 추가 해봤 캐시를 구현하기 위해 아래 mImageLoader 인스턴스를 만들 수 있습니다 이미지로드? – user2558461
imageView1이란 무엇입니까? 정의 된 부분은 어디입니까? –