小编Nai*_*ava的帖子

在回收站视图中加载大量项目

我在片段中有一个回收者视图,基本上我试图在回收者视图中加载歌曲列表.每行回收者视图包含一个imageview(用于专辑封面)和textview(用于歌曲名称).我遇到麻烦,当数据集的大小很大时,即当歌曲太多时,回收者视图滞后,应用程序最终给出ANR.我正在使用Glide在每行的imageview中加载专辑艺术.谷歌音乐播放器如何能够显示如此大量的歌曲而没有任何延迟?

编辑: 这是我的SongsFragment

public class SongsFragment extends Fragment {
static {
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
ProgressBar progressBar;    // progress bar to show after every 30 items
NestedScrollView nestedScrollView;  //for smooth scrolling of recyclerview as well as to detect the end of recyclerview
RecyclerView recyclerView;
ArrayList<Song> songMainList = new ArrayList<>();  //partial list in which items are added
ArrayList<Song> songAllList = new ArrayList<>(); //Complete List of songs
SongAdapter songsAdapter;
private LinearLayoutManager layoutManager;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, …
Run Code Online (Sandbox Code Playgroud)

android mediastore recycler-adapter android-recyclerview android-glide

9
推荐指数
2
解决办法
1万
查看次数