title: make custom item for each recyclerView item
body: <p>I'm newbie in android and I want to make custom item for each recyclerView item. In one item of rv there might be several linearLayouts with data. Initial I added linear layout to item of rv one by one. But in the process layouts of another item is duplication in item.</p>
  <p>This is the onBind function of my Adapter class.</p>
  <pre><code>fun onBind(letterItem: LetterItem, position: Int, counter: ArrayList&lt;Int&gt;){
          val alphabetList = letterItem.list
            binding.apply {
              cvLetterBig.setCardBackgroundColor(
                  ContextCompat.getColor(
                      context,
                      letterItem.bgColor
                  )
              )
              DrawableCompat.setTint(
                  binding.imageIcon.drawable,
                  ContextCompat.getColor(context, letterItem.bgColor)
              )
              textLetterBig.text = letterItem.text
              binding.linearLayout.visibility = View.GONE
  
              for (x in 0 until alphabetList.size) {
                  Log.d(&quot;-------------&quot;, &quot;onBind: x: $x&quot;)
                  val ll = binding.llAdding
                  val dp = context.resources.displayMetrics.density
  
                  val layout = LinearLayout(context)
                  layout.orientation = LinearLayout.HORIZONTAL
                  layout.layoutParams =
                      LinearLayout.LayoutParams(
                          LinearLayout.LayoutParams.MATCH_PARENT,
                          LinearLayout.LayoutParams.MATCH_PARENT
                      )
                  ViewUtils.setMargins(layout, 0, (10 * dp).toInt(), 0, (10 * dp).toInt())
  
                  val titleView = TextView(context)
                  val tlparams =
                      ViewGroup.LayoutParams(
                          ViewGroup.LayoutParams.MATCH_PARENT,
                          ViewGroup.LayoutParams.WRAP_CONTENT
                      )
                  titleView.id = x
                  titleView.layoutParams = tlparams
                  titleView.text = context.getString(alphabetList[x])
                  titleView.textSize = 20F
                  titleView.setTextColor(ContextCompat.getColor(context, R.color.grey20_800))
                  titleView.gravity = Gravity.CENTER_VERTICAL
                  titleView.setPadding((25 * dp).toInt(), 0, 0, 0)
  
                  val imageView = ImageView(context)
                  val ilparams =
                      LinearLayout.LayoutParams(
                          ViewGroup.LayoutParams.WRAP_CONTENT,
                          LinearLayout.LayoutParams.WRAP_CONTENT
                      )
  
                  ilparams.gravity = Gravity.CENTER
                  imageView.layoutParams = ilparams
                  imageView.setImageDrawable(
                      ContextCompat.getDrawable(
                          context,
                          R.drawable.ic_checked
                      )
                  )
                  layout.id = x
                  layout.tag = x
                  layout.addView(imageView)
                  layout.addView(titleView)
                  layout.setOnClickListener(clickListener)
  
                  ll.addView(layout) // here im adding that layout, whit in proccess it is duplicating
                }
          }
  </code></pre>
  <p>This is the my fragment</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;layout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;
  
      &lt;LinearLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;&gt;
          &lt;androidx.constraintlayout.widget.ConstraintLayout
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot;&gt;
  
              &lt;androidx.recyclerview.widget.RecyclerView
                  android:id=&quot;@+id/rv_alphabet&quot;
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:clipToPadding=&quot;false&quot;
                  android:layout_marginHorizontal=&quot;25dp&quot;
                  android:layout_marginTop=&quot;25dp&quot;
                  android:padding=&quot;10dp&quot;
                  android:background=&quot;@drawable/bg_alphabet&quot;
                  app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                  app:layout_constraintStart_toStartOf=&quot;parent&quot;
                  app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
              &lt;androidx.recyclerview.widget.RecyclerView
                  android:id=&quot;@+id/rv_big_alphabet&quot;
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;0dp&quot;
                  android:paddingVertical=&quot;8dp&quot;
                  android:clipToPadding=&quot;true&quot;
                  android:layout_marginHorizontal=&quot;25dp&quot;
                  app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
                  app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                  app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
                  app:layout_constraintTop_toBottomOf=&quot;@id/rv_alphabet&quot; /&gt;
  
          &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  <p>and this is the lower item of rv</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;layout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:id=&quot;@+id/cl_big&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginVertical=&quot;10dp&quot;&gt;
  
          &lt;androidx.cardview.widget.CardView
              android:id=&quot;@+id/cv_letter_big&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot;
              android:outlineSpotShadowColor=&quot;@color/white&quot;
              app:cardCornerRadius=&quot;8dp&quot;
              app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot;&gt;
  
              &lt;androidx.constraintlayout.widget.ConstraintLayout
                  android:id=&quot;@+id/cl_outter&quot;
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;match_parent&quot;&gt;
  
                  &lt;TextView
                      android:id=&quot;@+id/text_letter_big&quot;
                      android:layout_width=&quot;match_parent&quot;
                      android:layout_height=&quot;40dp&quot;
                      android:gravity=&quot;center&quot;
                      android:text=&quot;A&quot;
                      android:textColor=&quot;@color/white&quot;
                      android:textSize=&quot;20sp&quot;
                      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                      app:layout_constraintStart_toStartOf=&quot;parent&quot;
                      app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
                  &lt;androidx.constraintlayout.widget.ConstraintLayout
                      android:id=&quot;@+id/cl_inner&quot;
                      android:layout_width=&quot;match_parent&quot;
                      android:layout_height=&quot;match_parent&quot;
                      android:layout_margin=&quot;0.5dp&quot;
                      android:background=&quot;@drawable/bg_alphabet&quot;
                      app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
                      app:layout_constraintRight_toRightOf=&quot;parent&quot;
                      app:layout_constraintTop_toBottomOf=&quot;@id/text_letter_big&quot;&gt;
  
                      &lt;LinearLayout
                          android:id=&quot;@+id/ll_adding&quot;
                          android:layout_width=&quot;match_parent&quot;
                          android:layout_height=&quot;match_parent&quot;
                          android:orientation=&quot;vertical&quot;
                          android:paddingVertical=&quot;20dp&quot;
                          android:paddingStart=&quot;20dp&quot;
                          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
                          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                          app:layout_constraintStart_toStartOf=&quot;parent&quot;
                          app:layout_constraintTop_toTopOf=&quot;parent&quot;&gt;
  
  
                          &lt;LinearLayout
                              android:id=&quot;@+id/linearLayout&quot;
                              android:layout_width=&quot;match_parent&quot;
                              android:layout_height=&quot;match_parent&quot;
                              android:layout_marginBottom=&quot;10dp&quot;
                              android:orientation=&quot;horizontal&quot;&gt;
  
                              &lt;ImageView
                                  android:id=&quot;@+id/image_icon&quot;
                                  android:layout_width=&quot;20dp&quot;
                                  android:layout_height=&quot;20dp&quot;
                                  android:layout_gravity=&quot;center_vertical&quot;
                                  app:srcCompat=&quot;@drawable/ic_checked&quot; /&gt;
  
                              &lt;TextView
                                  android:layout_width=&quot;match_parent&quot;
                                  android:layout_height=&quot;wrap_content&quot;
                                  android:layout_marginStart=&quot;25dp&quot;
                                  android:gravity=&quot;center_vertical&quot;
                                  android:text=&quot;Advocat&quot;
                                  android:textColor=&quot;@color/grey20_800&quot;
                                  android:textSize=&quot;20sp&quot; /&gt;
                          &lt;/LinearLayout&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
              &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
          &lt;/androidx.cardview.widget.CardView&gt;
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  <p>Or does anyone have any idea how to solve it or other ways of usage?</p>