Listview Repeat Action

Good evening stackoverflow

This time I'm fighting a ListView containing text items.

I am adding an OnItemClick listener.

    v.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long arg3) {
            TextView tvItm = (TextView) arg1;
            int Col = tvItm.getTextColors().getDefaultColor();
            if (Col == Color.WHITE)
                tvItm.setTextColor(Color.GREEN);
            else
                tvItm.setTextColor(Color.WHITE);
        }
    });

As you can see, I switch the text color and it works. BUT, it works on several items at a time, although I only click one item. So when I click on the first element, it turns green, then six white elements, and the 7th element turns green, but I never pressed the 7th element.

item1 - -
item2 - -
item3 - -
item4 - -
item5 - -
item6 - -
item7 - -
item8 - -
item9 - -
....

.

, , 1 2 .

: List problem

:
: "AK Kusine"
. , " " .

Listener, . ? , ?

0
3

, getView . getView(int position, View convertView, ViewGroup parent) ( ) , convertView ..

. , .

+1

, -, ListView. , , - , , , ListView.getView() -

if(listItem.isGreen())
    view.setColor(Color.GREEN);
0

, , - . , , , , , 7- - . , ( ) getView ,

0

All Articles