0

I've used a list selector to display different colours depending on the the state (selected and otherwise). Below is my listselector code:

//Orange on selected
<item android:drawable="@color/orange" android:state_selected="true"/> 

//Black otherwise
<item android:drawable="@color/black"/>

In my main activity i also set the view as : view.setSelected(true);

However after selecting a list item, the colour is still orange.

Does anyone know how to resolve this?

4
  • However after selecting a list item, the color is still orange isnt that was you want? if you are setting something as selecting then it will appear orange and not black
    – tyczj
    Sep 24, 2013 at 16:09
  • @tyczj yes that's what i want. But after i go on to do other things within the same view, the colour doesn't change. The list is within a sliding drawer. Sep 24, 2013 at 16:12
  • you have to remove the selection then. Are you just trying to highlight a row to show its selected?
    – tyczj
    Sep 24, 2013 at 16:14
  • @tyczj yes i'm just trying to highlight the row. Sep 24, 2013 at 16:16

1 Answer 1

0

you are using the wrong state for the color, you need to use the activated state.

check out my question I had on this

Showing the current selection in a listview

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.