ChildAdapter.java 1.41 KB
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());

        }

    }
}