2番目の項目をマークしたい場合は、次のコードを実行しています。このコードは、ArrayAdapterを拡張するアダプターからのものです。
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.channel_list, null);
}
MyContent o = items.get(position);
if (o != null) {
TextView tt = (TextView) convertView.findViewById(R.id.toptext);
TextView bt = (TextView) convertView.findViewById(R.id.bottomtext);
if (tt != null) {
tt.setText(o.Top());
}
if(bt != null){
bt.setText(o.Bottom());
}
if(position == 2) {
convertView.setBackgroundColor(R.color.selectem_color);
}
}
return convertView;
リストビューが表示されますが、このアイテムの後の9番目のアイテムごとにマークが付けられます(11番目のアイテムは13番目など)。
誰かが理由を知っていますか?