0
H,我正在開發一個應用程序,該應用程序顯示列表中的所有視頻。裝貨清單到RecyclerView當我的問題,在列表中的所有項目是微小的1,2秒鐘,然後填寫所有資料,如下面的圖像:
Android - RecyclerView正在緩慢加載小數據
- 列表項
- 1,2秒後:
- 這是我的適配器:
@Override public void onBindViewHolder(final MostPopularByCountryAdapter.ViewHolder holder, final int position) { // fetch data to UI holder.order.setText(String.valueOf(position + 1)); holder.name.setText(mListVideo.get(position).getTitle()); Picasso.with(mContext).load(mListVideo.get(position).getThumbnailsHigh().getUrl()).into(holder.videoThumbnail); holder.duration.setText(UtilitySupport.convertDuration(mListVideo.get(position).getDuration().trim())); boolean isFavour = dataPreferences.getBookmarkVideo(mListVideo.get(position).getVideoId()); mListVideo.get(position).setFavourite(isFavour); final VideoStorageEntity storageEntity = new VideoStorageEntity(); storageEntity.setVideoId(mListVideo.get(position).getVideoId()); storageEntity.setFavourite(isFavour); storageEntity.setThumbnailsHighUrl(mListVideo.get(position).getThumbnailsHigh().getUrl()); storageEntity.setTitle(mListVideo.get(position).getTitle()); // setting 3 button action // // favourite event holder.viewLike.setOnStateChangeListener(true, mListVideo.get(position).isFavourite(), new OnStateChangeListener() { @Override public void onSelectedChange(boolean isSelected) { if (isSelected) { holder.isLike.setImageResource(R.drawable.ic_action_love_press); dataPreferences.saveBookmarkVideo(storageEntity); } else { holder.isLike.setImageResource(R.drawable.ic_action_love_white); dataPreferences.removeBookmarkVideo(storageEntity); } mListVideo.get(position).setFavourite(isSelected); } }); if (mListVideo.get(position).isFavourite()) { holder.isLike.setImageResource(R.drawable.ic_action_love_press); } else { holder.isLike.setImageResource(R.drawable.ic_action_love_white); } }
mListVideo中的數據是來自服務器嗎? –
您正在重複加載視頻數據,幾乎肯定是從服務器上加載的。是的,那永遠不會工作。 –
我忘了添加佔位符。路易斯Nguyen建議我。謝謝你 –