【发布时间】:2018-02-01 19:47:43
【问题描述】:
我的 recyclerview 滚动很慢。当我通过触摸 Recyclerview 开始滚动时它会滞后,但从它上方的视图开始时不会滞后。 我还在 recyclerview 上禁用了嵌套滚动。
这是我的布局:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true">
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
android:text="HAHHAHA"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/mRecyclerViewMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:background="@android:color/transparent">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</FrameLayout>
这是延迟的video。这就像滚动正在跳过一些布局。
【问题讨论】:
-
setNestedScrollView = false在回收站视图中 -
@PriteshVadhiya 我在 OnCreate() 方法中将嵌套滚动设置为 false。
mRecyclerViewMain.setNestedScrollingEnabled(false); -
使用 .setHasFixedSize(true) 设置 recyclerview 可以稍微提高性能。谢谢
标签: android android-recyclerview nestedscrollview