import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.example.myapplication.R; import java.util.ArrayList; /** * @author:created By ZhangHao * 时间:2019/4/26 15 * 邮箱:188660586@qq.com */ public class site_choseAdapter extends ArrayAdapter { public site_choseAdapter(Context context, int resource, ArrayList<String> arrlist) { super(context, resource,arrlist); } @Override public View getView(int position, View convertView, ViewGroup parent) { String site = (String)getItem(position); View view = LayoutInflater.from(getContext()).inflate(R.layout.item_site_chose, null); TextView tv_site = (TextView)view.findViewById(R.id.tv_site); tv_site.setText(site); return view; } }