title: I am using viewpager2 inside a recyclerview but the images are not outputting. Why?
body: <p>No matter what I do the pictures are not showing up.</p>
  <p>Even if I set the items to match parent, I still have the same problem, I've been dealing with it since the morning, if I find it, I will relax very well :D</p>
  <p>This is my adapter for viewpager 2 :</p>
  <pre><code>    class ViewPagerAdapter ( private val context : Context , private val album_id : Int , private val photo_list : ArrayList&lt;Photos&gt; ) : RecyclerView.Adapter&lt;ViewPagerAdapter.PagerHolder&gt;()  {
      
          inner class PagerHolder (view : View ) : RecyclerView.ViewHolder ( view ) {
      
              var image_view : ImageView
      
              init {
      
                  image_view = view.findViewById ( R.id.pager_imageview )
              }
          }
      
          override fun onCreateViewHolder(parent : ViewGroup, viewType : Int) : PagerHolder {
      
              val v = LayoutInflater.from ( parent.context ).inflate ( R.layout.viewpager_item , parent , false )
      
              return PagerHolder ( v )
          }
      
          override fun onBindViewHolder (holder : ViewPagerAdapter.PagerHolder, position : Int ) {
      
              val list = photo_list.filter { it.albumId == album_id }
      
              for ( i in list [ position ].url ) {
      
                      Glide.with ( context ).load ( i.toString() ).diskCacheStrategy ( DiskCacheStrategy.ALL ).into ( holder.image_view )
              }
          }
      
          override fun getItemCount ( ) : Int {
      
              return photo_list.size
          }
      }
  </code></pre>
  <p>This is my xml code for my viewpager items :</p>
  <pre><code>    &lt;androidx.cardview.widget.CardView xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
          xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          app:cardCornerRadius=&quot;20dp&quot;&gt;
      
          &lt;androidx.constraintlayout.widget.ConstraintLayout
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot;&gt;
      
              &lt;ImageView
                  android:id=&quot;@+id/pager_imageview&quot;
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;match_parent&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&gt;
      
      &lt;/androidx.cardview.widget.CardView&gt;
  </code></pre>
  <p>This is my recyclerview defined codes:</p>
  <pre><code>class AlbumRecyclerAdapter (  private val context : Context , private val album_list : ArrayList&lt;Albums&gt; , private val photo_list : ArrayList&lt;Photos&gt; ) : RecyclerView.Adapter&lt;AlbumRecyclerAdapter.Adapterholder&gt;() {
  
      inner class Adapterholder(view : View) : RecyclerView.ViewHolder(view) {
  
          var album_title : TextView
  
          var view_pager2 : ViewPager2
  
          init {
  
              album_title = view.findViewById(R.id.album_title)
  
              view_pager2 = view.findViewById ( R.id.view_pager2 )
          }
      }
  
      override fun onCreateViewHolder(parent : ViewGroup, viewType : Int) : Adapterholder {
  
          val v = LayoutInflater.from ( parent.context ).inflate ( R.layout.album_recycler_list , parent , false )
  
          return Adapterholder(v)
      }
  
      override fun onBindViewHolder ( holder : AlbumRecyclerAdapter.Adapterholder , position : Int) {
  
          val pager_adapter = ViewPagerAdapter ( context , album_list [ position ].id ,  photo_list )
  
          holder.view_pager2.orientation = ViewPager2.ORIENTATION_HORIZONTAL
          holder.view_pager2.adapter = pager_adapter
          holder.view_pager2.clipToPadding = false
          holder.view_pager2.clipChildren = false
          holder.view_pager2.offscreenPageLimit = 3
          holder.view_pager2.getChildAt ( 0 ).overScrollMode = RecyclerView.OVER_SCROLL_NEVER
  
          holder.album_title.text = album_list [ position ].title
      }
  
      override fun getItemCount ( ) : Int {
  
          return album_list.size
      }
  }
  </code></pre>
  <p>Finally , this is my xml code for the recyclerview :</p>
  <pre><code>&lt;androidx.cardview.widget.CardView 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;300dp&quot;
      android:layout_marginTop =&quot;10dp&quot;
      android:layout_marginLeft =&quot;5dp&quot;
      android:layout_marginRight=&quot;5dp&quot;
      app:cardCornerRadius=&quot;20dp&quot;&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot; &gt;
  
          &lt;androidx.viewpager2.widget.ViewPager2
              android:id=&quot;@+id/view_pager2&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot;
              android:layout_marginStart=&quot;8dp&quot;
              android:layout_marginTop=&quot;32dp&quot;
              android:layout_marginEnd=&quot;8dp&quot;
              android:layout_marginBottom=&quot;80dp&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;TextView
              android:id=&quot;@+id/album_title&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginStart=&quot;8dp&quot;
              android:text=&quot;Album Title&quot;
              app:autoSizeTextType=&quot;uniform&quot;
              app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/view_pager2&quot; /&gt;
  
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  
  &lt;/androidx.cardview.widget.CardView&gt;
  </code></pre>