Search code examples
gridviewcolorsbackground-color

GridView with different background color


I have a GridView with 12 elements.

View v;
v.setBackgroundColor(Color.rgb(0, 107, 179));

I need to have the first 6 elements with a particular color and rest of 6 with another color.

Is it possible?


Solution

  • I answer by myself:

        if (position < 6)
    v.setBackgroundColor(Color.rgb(0, 107, 179));
    else
    v.setBackgroundColor(Color.rgb(0,91,153));