问题描述
我正在关注本教程:
http://www.journaldev.com/10024/android-recyclerview-and-cardview-example-tutorial
现在我面临一个奇怪的问题,RecyclerView
中每个CardView
项目之间的边距太大了.
Now I am facing a weird issue the margin between each CardView
item inside RecyclerView
is way too much.
问题
如何减小放置在RecyclerView
内的每个CardView
项目之间的边距?
How to reduce the Margin between each item of CardView
placed inside RecyclerView
?
推荐答案
我遇到了类似的问题,其中RelativeLayout作为recyclerview中每一行的根元素.
I faced similar issue, with RelativeLayout as the root element for each row in the recyclerview.
要解决此问题,请找到保存每一行的xml文件,并确保根元素的高度为wrap_content
NOT match_parent
.
To solve the issue, find the xml file that holds each row and make sure that the root element's height is wrap_content
NOT match_parent
.
这篇关于Android Recycler视图中项目之间的边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!