Domanda

Universal Image Loader did not apply the display image options in the imageLoader.loadImage This is my code

DisplayImageOptions options = new DisplayImageOptions.Builder()
        .showStubImage(R.drawable.loading_image_background)
        .showImageForEmptyUri(R.drawable.ic_launcher)
        .showImageOnFail(R.drawable.loading_image_background)
        .cacheInMemory()
        .cacheOnDisc()
        .bitmapConfig(Bitmap.Config.RGB_565)
        .displayer(new RoundedBitmapDisplayer (20))
        .build();

ImageSize targetSize = new ImageSize(50, 50);
        imageLoader.loadImage(image_poster_url, targetSize, options,
                new SimpleImageLoadingListener() {
                    @Override
                    public void onLoadingComplete(String imageUri,
                            View view, Bitmap loadedImage) {
                        holder.posterImage.setImageBitmap(loadedImage);
                    }
                });

Image is re sized and display perfectly in listview. but the display option(rounded bitmap diplayer)are does not applied to the image. any suggestions?

È stato utile?

Soluzione

.displayer(...) is applied only for ImageLoader.displayImage(...) calls. For ImageLoader.loadImage(...) you can use displayers yourself directly:

ImageSize targetSize = new ImageSize(50, 50);
imageLoader.loadImage(image_poster_url, targetSize, options,
            new SimpleImageLoadingListener() {
                @Override
                public void onLoadingComplete(String imageUri,
                        View view, Bitmap loadedImage) {
                    new RoundedBitmapDisplayer(20).display(holder.posterImage);
                }
            });
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top