本文介绍了Android支持库23.2版和RecyclerView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新至Android支持库23.2版,并在每个项目之间为RecyclerView添加了全屏空间.有人遇到过这个问题吗?

Updated to Android Support Library rev 23.2 and it added full screen spaces to RecyclerView between each item. Has anybody experienced this issue?

推荐答案

当您的RecyclerView行在滚动方向上的大小设置为match_parent时,会发生这种情况.

This occurs when your RecyclerView rows have their size set to match_parent in the scrolling direction.

例如,如果垂直的LinearLayoutManager的RecyclerView每行具有以下布局,则该行现在实际上将与父级的高度匹配.在23.2.0版之前,它仍然会简单地包装内容.

For example, if a RecyclerView with a vertical LinearLayoutManager has the following layout for each row, that row will now actually match the parent's height now. Before version 23.2.0 it would still simply wrap the content.

<View
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

在这种情况下,将高度更改为wrap_content将解决此问题.

In this case, changing the height to wrap_content will resolve the issue.

此问题在公告博客文章中进行了简要提及:

这篇关于Android支持库23.2版和RecyclerView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 21:33