我正在使用Picasso将URL中的图像加载到卧式recyclerview中,
public class pIndicatorAdaptor extends
RecyclerView.Adapter<pIndicatorAdaptor.IndicatorViewHolder> {
//constructor and other stuff
@Override
public IndicatorViewHolder onCreateViewHolder(ViewGroup parent, int vType) {
View view = layoutInflater.inflate(R.layout.i_item, parent, false);
return new IndicatorViewHolder(view);
}
@Override
public void onBindViewHolder(IndicatorViewHolder holder, int position) {
picasso.load(images.get(position).getSrc()).fit().centerCrop()
.into(holder.imageView, null);
}
class IndicatorViewHolder extends RecyclerView.ViewHolder {
ImageView imageView;
IndicatorViewHolder(@NonNull View itemView) {
super(itemView);
imageView = itemView.findViewById(R.id.imageView);
}
}
}
但是我得到这样的结果,底部的水平recyclerview是我加载图像的位置:
答案 0 :(得分:1)
当您像这样一直滚动浏览回收站视图时,它每次都会加载图像,当然,加载图像也要花费很多时间。我认为您应该对此使用glide,因为glide非常适合从缓存中加载图像(如果存在);)