【发布时间】:2018-12-15 20:21:13
【问题描述】:
我在滚动时遇到问题,我的意思是滚动速度很快,但在滚动完成之前看起来像是滞后了 这里我定义了 RecyclerView :
RecyclerView recyclerView=fragment.getRecyclerView();
LinearLayoutManager layoutManager = new LinearLayoutManager(fragment.getActivity(), LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(new DividerItemDecoration(fragment.getActivity(), LinearLayoutManager.VERTICAL));
ArrayList<InstaPostModel> rowListItems=getInstaPostListSample();
InstaPostAdapter rcAdapter = new InstaPostAdapter(rowListItems);
recyclerView.setAdapter(rcAdapter);
这里是onBindViewHolder
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
final InstaPostModel p = items.get(position);
context = holder.itemView.getContext();
Glide.with(context).load(R.mipmap.mee_small).into(holder.userPhoto);
Glide.with(context).load(R.drawable.post_image).into(holder.photo_content);
Glide.with(context).load(R.mipmap.love_gray_icon).into(holder.bt_like);
Glide.with(context).load(R.mipmap.comment_icon).into(holder.bt_comment);
Glide.with(context).load(R.mipmap.share_icon).into(holder.bt_share);
holder.userNameTextView.setText(p.getPosterUserName());
holder.postContent.setText(p.getText());
holder.post_date.setReferenceTime(p.getDate().getTime());
}
这里是 RecyclerView.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/qatar_now_posts_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
tools:context=".uis.fragments.home.QatarNowFragment"
/>
编辑 我也在同一个片段中有底部导航栏,它在滚动时显示
编辑 2 这是视频 link 显示滞后
我尝试了所有解决方案,但没有人帮助我。
我已经添加了我所有的代码
请帮忙?
【问题讨论】:
-
片段的父布局是什么?如果是滚动条,请参考:stackoverflow.com/questions/32525314/…
-
我只有 recyclerview 元素
-
@MohammadSommakia 这些图片的尺寸这么大吗?
-
不,大约 50 kb
-
在您的 recyclerview 的每个项目中,您都在加载相同的图像。那你为什么不在布局文件中设置这些图像呢?
标签: android android-recyclerview smooth-scrolling recyclerview-layout