ChildAdapter.java
1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.shunzhi.parent.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter;
import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder;
import com.shunzhi.parent.R;
import com.shunzhi.parent.bean.ChildBean;
/**
* Created by Administrator on 2018/3/9 0009.
*/
public class ChildAdapter extends BaseRecyclerViewAdapter<ChildBean>{
Context context;
public ChildAdapter(Context context){
this.context=context;
}
@Override
public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view= LayoutInflater.from(context).inflate(R.layout.item_childlist,null);
return new MyViewHolder(view);
}
private class MyViewHolder extends BaseRecyclerViewHolder<ChildBean>{
TextView txt_childname,txt_childclass;
public MyViewHolder(View view) {
super(view);
txt_childname=view.findViewById(R.id.txt_childname);
txt_childclass=view.findViewById(R.id.txt_childclass);
}
@Override
public void onBindViewHolder(ChildBean object, int position) {
txt_childname.setText(object.getStudentName());
txt_childclass.setText(object.getSchoolName()+" "+object.getClassName());
}
}
}