title: Kotlin - RecyclerView doesn't display items but no error
body: <p><strong>I try to make a simple recycler view on Kotlin with Android Studio. But it doesn't display item.</strong>
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\</p>
  <p>I have a MainActivity.kt :</p>
  <pre><code>package fr.monarch.viper
  
  import androidx.appcompat.app.AppCompatActivity
  import android.os.Bundle
  import fr.monarch.viper.fragments.CommandesFragment
  
  class MainActivity : AppCompatActivity() {
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
          //injecter le fragment commandes fragment
          val transaction = supportFragmentManager.beginTransaction()
          transaction.replace(R.id.fragment_container, CommandesFragment())
          transaction.addToBackStack(null)
          transaction.commit()
      }
  }
  </code></pre>
  <p>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\<br />
  <strong>A activity_main.xml:</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout 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;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.MainActivity&quot;&gt;
  
      &lt;TextView
          android:id=&quot;@+id/textView&quot;
          style=&quot;@style/DefaultTextStyle&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginStart=&quot;@dimen/default_margin&quot;
          android:layout_marginTop=&quot;@dimen/default_margin&quot;
          android:text=&quot;@string/app_name&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
      &lt;FrameLayout
          android:id=&quot;@+id/fragment_container&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:layout_marginTop=&quot;60dp&quot;
          /&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p><strong>fragment_page.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:orientation=&quot;vertical&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;&gt;
  
      &lt;TextView
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;50dp&quot;
          android:text=&quot;@string/commandes_effectuees&quot;
          android:layout_marginTop=&quot;@dimen/default_margin&quot;
          android:layout_marginStart=&quot;@dimen/default_margin&quot;/&gt;
  
      &lt;androidx.recyclerview.widget.RecyclerView
          android:id=&quot;@+id/commandes_recycler&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:orientation=&quot;vertical&quot;
          /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  <p><strong>Fragment class.kt</strong></p>
  <pre><code>package fr.monarch.viper.fragments
  
  import android.os.Bundle
  import android.view.LayoutInflater
  import android.view.View
  import android.view.ViewGroup
  import androidx.fragment.app.Fragment
  import androidx.recyclerview.widget.RecyclerView
  import fr.monarch.viper.R
  import fr.monarch.viper.adapter.ItemAdapter
  
  class CommandesFragment : Fragment() {
      override fun onCreateView(
          inflater: LayoutInflater,
          container: ViewGroup?,
          savedInstanceState: Bundle?
      ): View? {
          val view = inflater.inflate(R.layout.fragment_commandes, container,false)
  
          val verticalRecycler = view.findViewById&lt;RecyclerView&gt;(R.id.commandes_recycler)
          verticalRecycler.adapter = ItemAdapter(R.layout.item_commande)
  
          return view
      }
  }
  </code></pre>
  <p><strong>ItemAdapter class .kt</strong></p>
  <pre><code>package fr.monarch.viper.adapter
  
  import android.view.LayoutInflater
  import android.view.View
  import android.view.ViewGroup
  import android.widget.ImageView
  import android.widget.TextView
  import androidx.recyclerview.widget.RecyclerView
  import fr.monarch.viper.R
  
  class ItemAdapter(private val layoutId : Int) : RecyclerView.Adapter&lt;ItemAdapter.ViewHolder&gt;(){
  
      //Pour ranger tous les items
      class ViewHolder(view: View): RecyclerView.ViewHolder(view){
          //image item
          var article_image = view.findViewById&lt;ImageView&gt;(R.id.article_image)
          var article_name = view.findViewById&lt;TextView&gt;(R.id.article_name)
      }
  
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
          val view = LayoutInflater
              .from(parent.context)
              .inflate(layoutId, parent,false)
          return ViewHolder(view)
      }
  
      override fun onBindViewHolder(holder: ViewHolder, position: Int) {
      }
  
      override fun getItemCount(): Int = 5
      }
  
  </code></pre>
  <p><strong>and my item layout</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout
      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;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;&gt;
  
      &lt;androidx.cardview.widget.CardView
          android:id=&quot;@+id/cardView&quot;
          android:layout_width=&quot;80dp&quot;
          android:layout_height=&quot;80dp&quot;
          app:cardCornerRadius=&quot;10dp&quot;
          app:cardElevation=&quot;6dp&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;&gt;
  
          &lt;ImageView
              android:id=&quot;@+id/article_image&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot;
              android:scaleType=&quot;centerCrop&quot;
              android:src=&quot;@drawable/item_photo&quot;
              /&gt;
  
      &lt;/androidx.cardview.widget.CardView&gt;
  
      &lt;View
          android:id=&quot;@+id/view_separation&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;1dp&quot;
          android:visibility=&quot;invisible&quot;
          android:background=&quot;@color/black&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/article_name&quot;
          style=&quot;@style/DefaultTextStyle&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:text=&quot;@string/commande_item_name&quot;
          app:layout_constraintBottom_toTopOf=&quot;@+id/view_separation&quot;
          app:layout_constraintStart_toEndOf=&quot;@+id/cardView&quot;
          android:layout_marginStart=&quot;10dp&quot;/&gt;
  
      &lt;TextView
          android:id=&quot;@+id/article_price&quot;
          style=&quot;@style/SousTitreStyle&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:text=&quot;@string/commande_item_price&quot;
          app:layout_constraintStart_toStartOf=&quot;@+id/article_name&quot;
          app:layout_constraintTop_toBottomOf=&quot;@+id/view_separation&quot; /&gt;
  
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p>The problem is that it display no item in the recycler view and I get no error.</p>
  <hr />