title: Giving more spacing between 3 and 4 row item in Recycler GridLayoutManager
body: <p>I am using RecyclerView with GridLayoutManager as a layout for the bus ticket booking. Everything works fine but except the place where I stuck with the logics that I have to use to leave more spacing between 3 and 4 column item in all the rows. Basically my layout should be like as the screenshot attached below.</p>
  
  <p><strong>My Requirement:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/UuHqU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UuHqU.png" alt="enter image description here"></a></p>
  
  <p><strong>Current Output:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/BoZiy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BoZiy.png" alt="enter image description here"></a></p>
  
  <p>I am also posting my complete RecyclerView GridLayoutManager for your reference as follows</p>
  
  <p><strong>MultiSelectRecyclerViewAdapter.java</strong></p>
  
  <pre><code>public class MultiSelectRecyclerViewAdapter extends SelectableAdapter&lt;MultiSelectRecyclerViewAdapter.ViewHolder&gt; {
  
      private ArrayList&lt;String&gt; mArrayList;
      private Context mContext;
      private ViewHolder.ClickListener clickListener;
  
  
  
      public MultiSelectRecyclerViewAdapter (Context context, ArrayList&lt;String&gt; arrayList,ViewHolder.ClickListener clickListener) {
          this.mArrayList = arrayList;
          this.mContext = context;
          this.clickListener = clickListener;
  
      }
  
      // Create new views
      @Override
      public MultiSelectRecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
                                                               int viewType) {
  
          View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(
                  R.layout.row_multiselect, null);
  
          ViewHolder viewHolder = new ViewHolder(itemLayoutView,clickListener);
  
          return viewHolder;
      }
  
      @Override
      public void onBindViewHolder(ViewHolder viewHolder, int position) {
  
          viewHolder.tvName.setText(mArrayList.get (position));
  
          viewHolder.selectedOverlay.setVisibility(isSelected(position) ? View.VISIBLE : View.INVISIBLE);
  
      }
  
      @Override
      public int getItemCount() {
          return mArrayList.size();
      }
  
      public static class ViewHolder extends RecyclerView.ViewHolder  implements View.OnClickListener,View.OnLongClickListener  {
  
          public TextView tvName;
          private ClickListener listener;
          private final View selectedOverlay;
  
  
          public ViewHolder(View itemLayoutView,ClickListener listener) {
              super(itemLayoutView);
  
              this.listener = listener;
  
              tvName = (TextView) itemLayoutView.findViewById(R.id.tvName);
              selectedOverlay = (View) itemView.findViewById(R.id.selected_overlay);
  
              itemLayoutView.setOnClickListener(this);
  
              itemLayoutView.setOnLongClickListener (this);
          }
  
          @Override
          public void onClick(View v) {
              if (listener != null) {
                  listener.onItemClicked(getAdapterPosition ());
              }
          }
          @Override
          public boolean onLongClick (View view) {
              if (listener != null) {
                  return listener.onItemLongClicked(getAdapterPosition ());
              }
              return false;
          }
  
          public interface ClickListener {
              public void onItemClicked(int position);
  
              public boolean onItemLongClicked(int position);
          }
          }
      }
  </code></pre>
  
  <p><strong>MultiSelectRecyclerViewActivity.java</strong></p>
  
  <pre><code>public class MultiSelectRecyclerViewActivity extends AppCompatActivity implements MultiSelectRecyclerViewAdapter.ViewHolder.ClickListener {
  
      private Toolbar toolbar;
  
      private RecyclerView mRecyclerView;
      private MultiSelectRecyclerViewAdapter mAdapter;
      private RecyclerView.LayoutManager mLayoutManager;
  
      private ArrayList&lt;String&gt; mArrayList  = new ArrayList&lt;String&gt;();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate (savedInstanceState);
          setContentView(R.layout.activity_multiselect);
          toolbar = (Toolbar) findViewById(R.id.toolbar);
  
  
          for (int i = 1; i &lt;= 48; i++) {
  
              mArrayList.add ( ""+ i);
          }
  
          if (toolbar != null) {
              setSupportActionBar(toolbar);
              getSupportActionBar().setTitle("MultiSelectRecylcerView");
  
          }
  
          mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);
          mRecyclerView.setHasFixedSize(true);
          mRecyclerView.setLayoutManager(new GridLayoutManager (this,4));
          mAdapter = new MultiSelectRecyclerViewAdapter (MultiSelectRecyclerViewActivity.this,mArrayList,this);
          mRecyclerView.setAdapter (mAdapter);
  
  
      }
  
      @Override
      public void onItemClicked (int position) {
  
          toggleSelection(position);
      }
  
      @Override
      public boolean onItemLongClicked (int position) {
          toggleSelection(position);
  
          return true;
      }
  
      private void toggleSelection(int position) {
          mAdapter.toggleSelection (position);
  
      }
  }
  </code></pre>
  
  <p><strong>What I have tried in coding:</strong></p>
  
  <p>I have followed this <a href="https://gist.github.com/yqritc/ccca77dc42f2364777e1" rel="nofollow noreferrer">gist</a> to assign the spacing for my grid items using ItemDecoration as below. But unfortunately I could able to assign spacing only equally between all the items.</p>
  
  <pre><code>mRecyclerView.setLayoutManager(new GridLayoutManager(context, NUM_COLUMNS);
  ItemOffsetDecoration itemDecoration = new ItemOffsetDecoration(context, R.dimen.item_offset);
  mRecyclerView.addItemDecoration(itemDecoration);
  </code></pre>
  
  <p>Kindly please help me with any kind of tips and solutions to solve my case. I am completely stuck up how to proceed with this requirement and logic using RecyclerView which I considered should be the optimized approach. Thanks in advance.</p>