Android 支持库 rev 23.2 和 RecyclerView [英] Android Support Library rev 23.2 and RecyclerView

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

问题描述

更新到 Android Support Library rev 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.

此问题在公告博文中简要提及:

由于此更改,请务必仔细检查布局参数您的项目视图:以前忽略的布局参数(例如滚动方向上的 MATCH_PARENT)现在将得到完全尊重.

Due to this change, make sure to double check the layout parameters of your item views: previously ignored layout parameters (such as MATCH_PARENT in the scroll direction) will now be fully respected.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆