I have a dropdown navigation list in my ActionBar. I'd like to change the background color of the list item background depending on their position, as well as the currently selected item.
I've created my own class that extends ArrayAdapter
and changes the background like so:
@Override
public View getView (int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
v.setBackgroundColor(Color.parseColor(VideoGroup.getColorForId(position)));
return v;
}
@Override
public View getDropDownView (int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
v.setBackgroundColor(Color.parseColor(VideoGroup.getColorForId(position)));
return v;
}
This however results in the following – notice that the actual list items look pretty good, but the currently selected one does not.
How can I get the background color for Group 1
here to fill up the navigation button's area as a whole?