ListView で Universal Image Loader を使用しています。最初は完全に機能しますが、残りの時間は画像の角が丸くなりません。スクロールした場合にのみ、画像の境界線が再び丸くなります。
これは私のコードです:
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context).threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.discCacheFileNameGenerator(new Md5FileNameGenerator())
.tasksProcessingOrder(QueueProcessingType.LIFO).enableLogging()
.build();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config);
DisplayImageOptions options = new DisplayImageOptions.Builder()
.displayer(new RoundedBitmapDisplayer(50))
.showStubImage(R.drawable.ic_app)
.showImageForEmptyUri(R.drawable.camera)
.showImageOnFail(R.drawable.ic_error).cacheInMemory().cacheOnDisc()
.build();
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.listmessages_row, null);
}//End if
ImageView avatar = (ImageView) convertView.findViewById(R.id.ImageView_MessageRow);
ImageView avatarEmpty = (ImageView) convertView.findViewById(R.id.ImageView_PhotoProfileEmpty);
final int positionAux = position;
if (listItems.get(position).avatar.equals("no_avatar")){
avatarEmpty.setVisibility(View.VISIBLE);
avatar.setVisibility(View.GONE);
}else{
avatarEmpty.setVisibility(View.GONE);
avatar.setVisibility(View.VISIBLE);
imageLoader.displayImage(IMAGES + listItems.get(position).avatar, avatar, options);
}//End if-else
return convertView;
}//End getView