滚动页面时滞后

时间:2018-10-02 13:46:19

标签: java android picasso

我是android新手。我正在尝试使用Picasso加载很多图像(墙纸),并且所有图像都已成功加载到应用程序中,但是在滚动页面时却非常滞后。 我试图减小图像的尺寸和分辨率,但是它不起作用并且仍然滞后。

public void onBindViewHolder(RecyclerView.ViewHolder holder_parent, final int position) {
    switch (getItemViewType(position)) {
        case 1: {
            final WallpaperHolder holder = (WallpaperHolder) holder_parent;
            holder.relative_layout_wallpaper_item.setBackgroundColor(Color.parseColor(wallpaperList.get(position).getColor()));
            holder.linear_layout_wallpaper_item.setBackgroundColor(Color.parseColor(wallpaperList.get(position).getColor()));
            holder.text_view_wallpaper_item_title.setText(wallpaperList.get(position).getTitle());
            holder.text_view_wallpaper_item_user.setText(wallpaperList.get(position).getUser());
            Picasso.with(activity.getApplicationContext()).load(wallpaperList.get(position).getThumbnail()).placeholder(R.drawable.placeholder).into(holder.image_view_wallpaper_item);
            if (wallpaperList.get(position).getReview()!=null){
                if (wallpaperList.get(position).getReview()){
                    holder.text_view_review_wallpaper_item.setVisibility(View.VISIBLE);
                }else{
                    holder.text_view_review_wallpaper_item.setVisibility(View.GONE);
                }
            }
            if (wallpaperList.get(position).getPremium()!=null){
                if (wallpaperList.get(position).getPremium()){
                    holder.image_view_item_wallpaper_premium.setVisibility(View.VISIBLE);
                }else{
                    holder.image_view_item_wallpaper_premium.setVisibility(View.GONE);
                }
            }

0 个答案:

没有答案