先上两张效果图:
——————————————————分割线————————————————————-
实体类
class Msg {
static final int TYPE_TIME = 0;
static final int TYPE_RECEIVE = 1;
static final int TYPE_SEND = 2;
String content;
int type;
Msg(String content, int type) {
this.content = content;
this.type = type;
}
}
Activity的布局都是一样
先说说第一张单一布局的实现,适合界面比较简单的时候使用
adapt
class MsgAdapter extends RecyclerView.Adapter<MsgAdapter.MyViewHolder> {
private ArrayList<Msg> mMsgList;
MsgAdapter(ArrayList<Msg> mMsgList) {
this.mMsgList = mMsgList;
}
@Override
public