I am trying to implement the Horizontal RecyclerView inside the ViewPager2, but its not working.
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvMusicList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="horizontal"
tools:listitem="@layout/items_music"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="30dp"/>
...
My Kotlin Code is below
rvBottomMenu.apply {
layoutManager =
LinearLayoutManager(this@MainActivity, RecyclerView.HORIZONTAL, false)
adapter = bottomMenuAdapter
setHasFixedSize(true)
}
I tried the below link solution, but not worked: text