我扩展了ArrayAdapter,画了下图
public class UrlArrayAdapter extends ArrayAdapter<UrlItem> {
private LayoutInflater inflater;
public UrlArrayAdapter(Context context, List<UrlItem> urlLists) {
super(context, R.layout.database_table_list, R.id.editLinearLayout1,urlLists);
inflater = LayoutInflater.from(context);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
UrlItem urlItem = (UrlItem) this.getItem(position);
CheckBox checkBox = null;
TextView textView = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.database_table_item, null);
textView = (TextView) convertView.findViewById(R.id.editText1);
checkBox = (CheckBox) convertView.findViewById(R.id.checkBox1);
convertView.setTag(urlItem);
checkBox.setChecked(urlItem.getUse());
textView.setText(urlItem.getUrl());
textView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
}
});
} else {
}
return convertView;
}
}
如何识别和删除我按下的位置? setOnClickListener() - 不起作用 - 账号点击时间长