title: How to Skip First Row in RecyclerView Item Decoration for GridLayout?
body: <p>I'm using this ItemDecoration class for GridLayout -> <a href="https://github.com/devunwired/recyclerview-playground/blob/master/app/src/main/java/com/example/android/recyclerplayground/GridDividerDecoration.java">https://github.com/devunwired/recyclerview-playground/blob/master/app/src/main/java/com/example/android/recyclerplayground/GridDividerDecoration.java</a></p>
  
  <p>But the problem is, my first row in GridLayout is an image and I set the span to 2.</p>
  
  <p>You can view my screen as per screenshot below :</p>
  
  <p><img src="https://i.stack.imgur.com/IQvHZ.png" alt="Screenshot"></p>
  
  <p>How to skip the first row so that ItemDecoration didn't draw on the Image?</p>
  
  <p>Below is the code that I'm using to add the ItemDecoration :-</p>
  
  <pre><code>mRecyclerView.setHasFixedSize(true);
  mLayoutManager = new GridLayoutManager(getActivity(), 2);
  mLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
      @Override
      public int getSpanSize(int position) {
          return position == 0 ? 2 : 1;
      }
  });
  mRecyclerView.setLayoutManager(mLayoutManager);
  mAdapter.setHighlightsCallbacks(this);
  mRecyclerView.setAdapter(mAdapter);
  mRecyclerView.setItemAnimator(new DefaultItemAnimator());
  mRecyclerView.addItemDecoration(new GridDividerDecoration(getActivity()));
  </code></pre>
  
  <p>I also modified the drawHorizontal method in GridDividerDecoration class to only draw if imageview is null but still not working :-</p>
  
  <pre><code>public void drawHorizontal(Canvas c, RecyclerView parent) {
  
      final int top = parent.getPaddingTop();
      final int bottom = parent.getHeight() - parent.getPaddingBottom();
  
      final int childCount = parent.getChildCount();
  
      for (int i = 0; i &lt; childCount; i++) {
          final View child = parent.getChildAt(i);
          if (child.findViewById(R.id.home_imgHeader) == null) {
              final RecyclerView.LayoutParams params =
                      (RecyclerView.LayoutParams) child.getLayoutParams();
              final int left = child.getRight() + params.rightMargin + mInsets;
              final int right = left + mDivider.getIntrinsicWidth();
              mDivider.setBounds(left, top, right, bottom);
              mDivider.draw(c);
          }
      }
  }
  </code></pre>
  
  <p>Any help?</p>