使用通用映像加载器在单行中加载多个映像

时间:2016-02-03 09:58:35

标签: android universal-image-loader

我正在使用UIL使用ListView加载图像 每行中有两个图像,UIL只加载一个图像而另一个图像不显示

        LTH.dLog(TAG, "User Name : " + getItem(position).getAgentName() + " " + getItem(position).getAgentFamily());
        LTH.dLog(TAG, "User Avatar : " + getItem(position).getAgentAvatar());
        LTH.dLog(TAG, "Insurance Avatar : " + getItem(position).getAgentInsuranceAvatar());
        LTH.dLog(TAG, "****************************************");

        imageLoaderInsurance = ImageLoader.getInstance();
        optionsInsurance = new DisplayImageOptions.Builder()
                // .displayer(new RoundedBitmapDisplayer((int) 27.5f))
                .showImageOnLoading(R.drawable.thumb_list)
                .showImageForEmptyUri(R.drawable.thumb_list)
                .showImageOnFail(R.drawable.thumb_list)
                .cacheInMemory(true)
                .cacheOnDisc(true)
                .considerExifParams(true)
                .postProcessor(new BitmapProcessor() {
                    @Override
                    public Bitmap process(Bitmap bitmap) {
                        return null;
                    }
                })
                .imageScaleType(ImageScaleType.NONE)
                .bitmapConfig(Bitmap.Config.ARGB_8888)
                .build();

        imageLoaderInsurance.init(ImageLoaderConfiguration.createDefault(App.getContext()));
        imageLoaderInsurance.displayImage(getItem(position).getAgentInsuranceAvatar(), img_insurance_avatar, optionsInsurance);

        imageLoader = ImageLoader.getInstance();
        options = new DisplayImageOptions.Builder()
                .displayer(new RoundedBitmapDisplayer(App.getContext().getResources().getDimensionPixelSize(R.dimen.global_radius)))
                .showImageOnLoading(R.drawable.profile_user)
                .showImageForEmptyUri(R.drawable.profile_user)
                .showImageOnFail(R.drawable.profile_user)
                .cacheInMemory(true)
                .cacheOnDisc(true)
                .considerExifParams(true)
                .imageScaleType(ImageScaleType.NONE)
                .bitmapConfig(Bitmap.Config.RGB_565)
                .build();

        imageLoader.init(ImageLoaderConfiguration.createDefault(App.getContext()));
        imageLoader.displayImage(getItem(position).getAgentAvatar(), img_agent_avatar, options);

图片链接效果很好,我不知道为什么图片无法加载

User Avatar加载已完成,但Insurance Avatar未显示并且全部为空(R.drawable.thumb_list均未显示)

我如何解决它

1 个答案:

答案 0 :(得分:1)

只需删除postProcessor或在方法中返回位图,而不是null