您的位置:首页技术文章
文章详情页

android - 这样的ui 用recyclerview嵌套在一起怎么做啊

【字号: 日期:2024-08-20 17:28:46浏览:82作者:猪猪

问题描述

android - 这样的ui 用recyclerview嵌套在一起怎么做啊

People 和 Group 来自不同的数据接口,整体页面要滑动,如果想在一个recyclerview 里 嵌套这 两个 recyclerview 该怎么弄啊

adapter 该怎么写呢??

getItemViewType 方法里该怎么判断 加载 不同的布局呢??

问题解答

回答1:

RecyclerView 多Item 实现

这类基础的问题建议自己学会搜索,Google一下教程不要太多.

回答2:

@Overridepublic int getItemViewType(int position) { if (getItem(position).mUserType == ChatModel.UserType.Other) {return R.layout.item_chat_other; } else {return R.layout.item_chat_me; }} 用这个方法来判断 还有你标题栏和item栏也要做判断 根据people和group这两个字段来判断

相关文章: