search

Home  >  Q&A  >  body text

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

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

adapter 该怎么写呢??

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

高洛峰高洛峰2889 days ago668

reply all(2)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:15:05

    RecyclerView multi-item implementation

    For this kind of basic questions, it is recommended to learn to search by yourself. Don’t Google too many tutorials.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:15:05

    @Override
    public 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这两个字段来判断 
      

    reply
    0
  • Cancelreply