直播间聊天滚动问题
This commit is contained in:
parent
bbb25cde50
commit
e58915edb6
@ -106,7 +106,6 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
if (vh instanceof Vh) {
|
||||
vh.setIsRecyclable(false);
|
||||
((Vh) vh).setData(mList.get(position), position);
|
||||
} else if (vh instanceof RedPackVh) {
|
||||
((RedPackVh) vh).setData(mList.get(position));
|
||||
@ -382,7 +381,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
mList.add(bean);
|
||||
|
||||
if (isSlideToBottom(mRecyclerView)) {
|
||||
mRecyclerView.scrollToPosition(getItemCount() - 1);
|
||||
mRecyclerView.smoothScrollToPosition(getItemCount() - 1);
|
||||
} else {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER));
|
||||
|
@ -853,6 +853,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
layoutManager.setStackFromEnd(true);
|
||||
mChatRecyclerView.setLayoutManager(layoutManager);
|
||||
mChatRecyclerView.addItemDecoration(new TopGradual());
|
||||
mChatRecyclerView.setItemViewCacheSize(8);
|
||||
mLiveChatAdapter = new LiveChatAdapter(mContext);
|
||||
mChatRecyclerView.setAdapter(mLiveChatAdapter);
|
||||
mLiveChatAdapter.setOnItemClickListener(new OnItemClickListener<LiveChatBean>() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@drawable/bg_live_role"
|
||||
android:background="@drawable/bg_live_tota"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="171dp">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user