title: RecyclerView with various elements in the same line
body: <p>I would like to make a <code>RecyclerView</code> having differents elements per line depending on a boolean in the adapter.</p>
  
  <p>In my app, you have some banknote and coins. I have to put all in a <code>RecyclerView</code>. First of all I want to show the banknote (2 per 2) and after the coins (4 per 4)
  like this :</p>
  
  <p><a href="https://i.stack.imgur.com/SRWRl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SRWRl.png" alt="enter image description here"></a></p>
  
  <p>This is how I want the result look like :</p>
  
  <p><a href="https://i.stack.imgur.com/3E6dr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3E6dr.png" alt="enter image description here"></a></p>
  
  <p>This is my Adapter</p>
  
  <pre><code>    class MoneyAdapter(private val money_list: ArrayList&lt;Money&gt;) : RecyclerView.Adapter&lt;MoneyAdapter.ViewHolder&gt;() {
  
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MoneyAdapter.ViewHolder {
          val v = LayoutInflater.from(parent.context).inflate(R.layout.item_money, parent, false)
          return ViewHolder(v)
      }
  
      override fun onBindViewHolder(holder: MoneyAdapter.ViewHolder, position: Int) {
          money_map.put(money_list[position].value, 0)
          holder.bindItems(money_list[position])
      }
  
      inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
          fun bindItems(money: Money) {
              // if (money.isCoin) I would like to put it on a 4 element per line
              }
          }
      }
  
      override fun getItemCount(): Int {
          return money_list.size
      }
  
  }
  </code></pre>
  
  <p>This is where I declar emy RecyclerView :</p>
  
  <pre><code>recycler_money.layoutManager = StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)
  recycler_money.adapter = MoneyAdapter(getMoneyList(PrefsModel.currency)
  </code></pre>
  
  <p>I was searching a lot of examples but it's always with differents col/row using <code>StaggeredGridLayoutManager</code> and I want only change the number of elements by line (2 or 4) directly on the <code>Adapter</code>.</p>