嘿家伙我在一个recyclerview中实现了两张卡片,并且创建了两个视图持有者,但没有得到适配器的代码帮助我们。如何使用一个RecyclerView适配器使用多个布局?
public class ViewHolder1 extends RecyclerView.ViewHolder {
private TextView Chatin;
public ViewHolder1(View v) {
super(v);
Chatin = (TextView) v.findViewById(R.id.Chatin);
}
public TextView getChatin() {
return Chatin;
}
public void setChatin(TextView chatin) {
this.Chatin = chatin;
}
}
其他查看持有人是相同的,因为它是。
请参考网址http://stackoverflow.com/questions/25914003/recyclerview-and-handling-different-type-of-row-inflation可能会有所帮助。 –