【发布时间】:2018-05-29 18:26:41
【问题描述】:
我正在使用带有 horizontal recyclerView
的 tabLayout问题是当我滚动recyclerView时,tabLayout优先而不是RecyclerView。
只有当 tabLayout 位于最后一个 tab 时才会发生这种情况,tabLayout 不再滚动。
TabLayout 有这个属性
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
android:elevation="6dp"
app:tabMaxWidth="0dp"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabSelectedTextColor="#ffffff"
app:tabIndicatorColor="#ffffff"
app:tabTextAppearance="@style/CustomTextStyle"
>
我用属性 setHasFixedSize 设置了 recyclerView
recycler.setHasFixedSize(true)
这个 gif 显示了问题。
这里效果很好,因为tabLayout不在最后一个选项卡中。
【问题讨论】:
-
你有没有在你的 recyclerview 上尝试 setnestedscrollingenabled(false)
-
是的,我试过了,并没有改变任何东西。还是不行。
-
有人吗?我仍然有问题...... recyclerView 在 ScrollView 内,而 scrollview 在 viewPager 内。我使用了 SetNestedScrollingEnabled(false) 但不起作用。
标签: android scroll android-recyclerview android-tablayout