
IM即时通讯
安全可靠、全球互通

实时音视频
流畅稳定、省钱省力
回答:
IMKit 4.x:
ConversationListFragment 增加了新接口:
public void setAdapter(ConversationListAdapter adapter) public ConversationListAdapter getAdapter();
用户可以设置自己的 adapter 实现对会话列表的自定义
使用方法:
继承并实现 adapter,自定义 adapter 中的布局及显示,例如:自定义会话列表未读消息数显示红点,不显示未读数目
public class ConversationListAdapterEx extends ConversationListAdapter { public ConversationListAdapterEx(Context context) { super(context); } @Override protected View newView(Context context, int position, ViewGroup group) { return super.newView(context, position, group); } @Override protected void bindView(View v, int position, UIConversation data) { if(data.getConversationType().equals(Conversation.ConversationType.DISCUSSION)) data.setUnreadType(UIConversation.UnreadRemindType.REMIND_ONLY); super.bindView(v, position, data); } }
3. 在实例化 ConversationListFragment 时,设置 adapter
ConversationListFragment listFragment = ConversationListFragment.getInstance(); listFragment.setAdapter(new ConversationListAdapterEx(RongContext.getInstance())); Uri uri = Uri.parse("rong://" + getApplicationInfo().packageName).buildUpon() .appendPath("conversationlist") .appendQueryParameter(Conversation.ConversationType.PRIVATE.getName(), "false") //设置私聊会话是否聚合显示 .appendQueryParameter(Conversation.ConversationType.GROUP.getName(), "false")//群组 .appendQueryParameter(Conversation.ConversationType.DISCUSSION.getName(), "false")//讨论组 .appendQueryParameter(Conversation.ConversationType.PUBLIC_SERVICE.getName(), "false")//公共服务号 .appendQueryParameter(Conversation.ConversationType.SYSTEM.getName(), "false")//系统 .build(); listFragment.setUri(uri);
IMKit 5.x:
参考文档:
https://doc.rongcloud.cn/im/Android/5.X/ui/conversationlist/custom