0
I’m using baseAdapter:
@Override
public View getView(int posicao, View convertview, ViewGroup parent) {
View view = convertview;
ViewHolder holder = null;
if (view == null) {
holder = new ViewHolder();
view = inflater.inflate(R.layout.itens_lista, parent, false);
holder.itemNome = (TextView) view.findViewById(R.id.itemNome);
holder.itemEndereco = (TextView) view
.findViewById(R.id.itemEndereco);
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}
Telefone item = getItem(posicao);
holder.itemNome.setText(item.getNome());
holder.itemEndereco.setText(item.getTelefone());
return view;
}
But the items are "bugged":
- When I select an item it turns red background color, then I scroll and the color disappears back to the original, because I’m using viewHolder and the view is "recycled or reused";
- There are items that have a red background color other than the selected item.
Do you want to change the color whenever you click? That’s it?
– Mateus Carvalho
Yes... I already got it, but have more problems described above are 3 problems...
– Pedro Rangel