title: Change RecyclerView.ItemDecoration color per item
body: <p>I'm using a custom item decorator for my recyclerview and it works fine. </p>
  
  <p><strong>MyItemDecorationTest.java</strong></p>
  
  <pre><code>public class MyItemDecorationTest extends RecyclerView.ItemDecoration{
  
      private Paint paint;
      private final static int OFFSET = 8;
  
      public MyItemDecorationTest(Paint paint){
          this.paint = paint;
      }
  
      @Override
      public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
          super.getItemOffsets(outRect, view, parent, state);
          outRect.set(OFFSET, OFFSET, OFFSET, OFFSET);
      }
  
      @Override
      public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
          super.onDraw(c, parent, state);
  
          final RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
  
          for(int i=0; i&lt;parent.getChildCount(); i++){
              final View child = parent.getChildAt(i);
              c.drawRoundRect(layoutManager.getDecoratedLeft(child) + OFFSET,
                      layoutManager.getDecoratedTop(child) + OFFSET,
                      layoutManager.getDecoratedRight(child) - OFFSET,
                      layoutManager.getDecoratedBottom(child) - OFFSET, 2, 2, paint);
          }
      }
  }
  </code></pre>
  
  <p>And this is how I include it in my activity:</p>
  
  <pre><code>RecyclerView.ItemDecoration itemDecoration = new MyItemDecorationTest(getPaint(getResources().getColor(R.color.block_blue)));
  recyclerView.addItemDecoration(itemDecoration);
  </code></pre>
  
  <p>And this is my method to set the paint.</p>
  
  <pre><code>public Paint getPaint(int color){
      Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
      paint.setColor(color);
      paint.setStyle(Paint.Style.STROKE);
      paint.setStrokeWidth(4);
  
      return paint;
  }
  </code></pre>
  
  <p>This is the render:</p>
  
  <p><a href="https://i.stack.imgur.com/NxiOc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NxiOc.png" alt="item decoration example"></a></p>
  
  <p>Now I want to change the color of the decorator per item. That means for instance change the blue color of the second item with red. And this is what I expect to have:</p>
  
  <p><a href="https://i.stack.imgur.com/Fa2mG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fa2mG.png" alt="desire state"></a></p>
  
  <p>Is there any way to change decoration color on a per item basis using RecyclerView.ItemDecoration?</p>