文章详情页
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这两个字段来判断
相关文章:
1. angular.js - angularjs ng-repeat 不能刷新2. 老师,你这两条斜杠的是怎么注释的?3. mac连接阿里云docker集群,已经卡了2天了,求问?4. PHP单例模式5. css3 - css字体样式加填充色而不是背景色6. node.js - 来帮我捋一下node中fs模块watch实现原理7. docker 下面创建的IMAGE 他们的 ID 一样?这个是怎么回事????8. docker镜像无法删除,请求解决办法。9. angular.js - 用angular2-cli打包项目之后,跳转路由刷新会报404的错误10. angular.js - angularJS最简单方法实现点击checkbox,button变亮
排行榜