0

i have listView, each item have different BackgroundColor set in getView function:

if ((position % 2) == 0) {
    row.setBackgroundColor(Color.rgb(227, 227, 227));
} else {
    row.setBackgroundColor(Color.WHITE);
}

and when click any item change BackgroundColor, set this code in onItemClick function:

v.setBackgroundColor(color.pressedColor);

but when i return to listView by click back button the item which was click don't return to normal BackgroundColor, it color stay same pressed BackgroundColor.

how can return the default BackgroundColor when press back button?

4

1 回答 1

1

您可以在重新着色之前将当前颜色保存到临时变量中。然后让您的“后退”按钮将其更改回临时变量所持有的任何值。这将适用于单次颜色更改回滚,而无需任何主要的编码冒险。

于 2013-08-20T19:46:04.503 回答