views:

41

answers:

1

I would like to change the background color of a ListView Item after it has been touched until a further event.

This is my code:

listviewOfStuff.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
          // When clicked, show a toast with the TextView text
         //((TextView) view).getText()
         listviewOfStuff.getItemAtPosition(position).setBackgroundColor(Color.YELLOW);
          Toast.makeText(getApplicationContext(), "Please Wait",Toast.LENGTH_SHORT).show();
        }
      });

Changing the background color of view yields weird results. Help?

A: 

link text

gordonwd
I need to change the background color for an item in the list.
Mitchell
OK. I found this solution when I was trying to change the entire list background and it's working for that. Have you also tried using StateList color specs for your background?
gordonwd