我在这里阅读了很多关于 23.2.0 之后 RecycerView 更改的帖子,但是我仍然面临着我的回收器 View 中的巨大空白。我在 GitHub 上创建了一个小项目来演示这个问题:https://github.com/nathan-ca/TrialRecycler
截图如下:
我使用线条边框在项目周围绘制,它的大小几乎是屏幕高度的两倍。在 list_item.xml 中,如果我将 layout_height 更改为固定值,例如“100dp”,回收器 View 将正确显示项目。如果我改成match_parent,高度就和窗口一样了。当我使用 wrap_content 时,高度是窗口的两倍!所有在线帖子都说如果我使用“wrap_content”它应该会很好用。拼命不知道问题出在哪里。
最佳答案
我看到你的代码,发现你没有修复 ImageView
的 layout_height
,尝试将其修复为 60dp
<ImageView
android:id="@+id/item_image"
android:layout_width="60dp"
android:layout_height="wrap_content"
/>
关于android - RecyclerView items with big empty space v25.2.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42607113/