android - Android 我想让 recyclerView 在 Netflix 应用程序中具有相同的快速滚动
问题描述
我在嵌套滚动器的片段中有 7 个水平回收器视图当我滚动孔页或回收器视图界面停止 1 秒时出现问题我看到 NetFlix 电影和程序回收器非常快,但在我的应用程序中回收器不会从第一次触摸:我的应用与 NetFlix 非常相似
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="80dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingEnd="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:paddingStart="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="@font/kufi_bold_0"
android:singleLine="true"
android:text="@string/category"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/categoryRecycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:fastScrollEnabled="true"
app:fastScrollHorizontalThumbDrawable="@drawable/fast_scroll_thumb"
app:fastScrollHorizontalTrackDrawable="@drawable/fast_scroll_track"
app:fastScrollVerticalThumbDrawable="@drawable/fast_scroll_thumb"
app:fastScrollVerticalTrackDrawable="@drawable/fast_scroll_track"
android:nestedScrollingEnabled="false">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
解决方案
我希望这可能对你有所帮助。
对于科特林
recyclerView!!.isNestedScrollingEnabled = false
对于 Java
recyclerView.setNestedScrollingEnabled(false);