Ani*_*nde 17 android android-support-library android-recyclerview
我最近从支持库recyclerview-v7:23.1.1更新到recyclerview-v7:25.1.0.
我的布局包含2个在屏幕上分割50%的recylerviews.xml代码如下:
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">
    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView1"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:scrollbars="none"/>
    <android.support.v4.widget.Space
        android:layout_width="@dimen/two_dp"
        android:layout_height="match_parent"
        android:background="@color/dark_gray"/>
    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView2"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:scrollbars="none"/>
</LinearLayout>
现在为所有列表项而不是仅显示可见项调用onBindViewHolder. 这在更新后开始发生,以支持库25.1.0.
如果移除重量,它可以正常工作,但需要并排显示2个重定向视图.
如何告诉recyclerview回收视图而不是加载所有视图?
更新:它适用于棉花糖及以上设备.该问题出现在棒棒糖或以下.您可以在这里找到一个演示项目: https ://bitbucket.org/aniketit/recyclerviewtest
我遇到了删除加权和0dp元素后持续存在的相同问题.在我的情况下,问题相当简单 - 我无意中将我的RecyclerView放在一个带有fillViewPort = true的NestedScrollView中.这会导致适配器将为视图构建所有元素,您会发现响应性显着延迟.
事实证明,如果您只在普通的旧ScrollView中使用RecyclerView,则会出现问题.
| 归档时间: | 
 | 
| 查看次数: | 2782 次 | 
| 最近记录: |