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; import java.util.List; /** * @author:created By ZhangHao * 时间:2019/4/27 23 * 邮箱:188660586@qq.com */ public class query_siteAdapter extends ArrayAdapter { private ArrayList<String> list; public query_siteAdapter( Context context, int resource, ArrayList<String> arrlist) { super(context, resource, arrlist); this.list=arrlist; } @Override public View getView(int position, View convertView, ViewGroup parent) { String site=list.get(0); View view = LayoutInflater.from(getContext()).inflate(R.layout.item_query_site, null); TextView tv_query = view.findViewById(R.id.tv_query); tv_query.setText(site); return view; } }