Android中ViewPager2内嵌RecyclerView横向滚动失效问题求助
ViewPager2中横向RecyclerView滚动失效问题
在ViewPager2的页面内实现横向RecyclerView时,RecyclerView无法正常进行横向滚动操作。
布局代码
<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"/> ...
Kotlin代码
rvBottomMenu.apply { layoutManager = LinearLayoutManager(this@MainActivity, RecyclerView.HORIZONTAL, false) adapter = bottomMenuAdapter setHasFixedSize(true) }
已尝试过相关解决方案,但问题仍未解决。
内容的提问来源于stack exchange,提问作者Tousif Akram
相关产品推荐
相关产品推荐

