【问题标题】:I want to hide one recycler view where the other one is scrolled我想隐藏一个回收器视图,另一个是滚动的
【发布时间】:2021-01-22 07:17:13
【问题描述】:
所以,我的屏幕上有两个滚动视图。第一个是水平的,第二个是垂直的。第一个使用线性布局,第二个使用 GridLayout。如何隐藏第一个动画,而第二个向下滚动。
我已经尝试过 recyclerview.onScrollListener。但它没有显示动画,并且滚动看起来很不稳定。我也尝试过 discrollView 库,但它在这种情况下也不起作用。
请帮助我。提前致谢。
【问题讨论】:
标签:
java
android
android-recyclerview
android-animation
【解决方案1】:
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/firstReyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<androidx.recyclerview.widget.RecyclerView
android:layout_below="@id/firstReyclerView"
android:id="@+id/secondRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
并设置 secondRecyclerView.setNestedScrollingEnabled(false);