使用RecyclerView用卡 [英] Using RecyclerView with Card

查看:174
本文介绍了使用RecyclerView用卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有卡项目的部分RecyclerView。而在preLollipop设备,它看起来很好。但在棒棒糖看起来无子卡之间的间距。我试图用margin和padding,但它并没有帮助。当我使用的保证金棒棒糖它看起来不错,但对preLollipop间距相同幅度是非常大的。 再次:为什么会出现不同的间隔?其中财产,我应该用它来修复它?

I have some RecyclerView with Card items. And on preLollipop devices it looks fine. But on Lollipop it looks without any spacing between child cards. I tried to use margin and padding, but it didn't help. When I use margin on lollipop it looks fine, but with the same margin on preLollipop spacing is very big. Once again: why is there different spacings? Which property should I use to fix it?

推荐答案

这是发生因为L,阴影的视野范围,但preL之外,他们是视图中(遗憾的是没有真正的影子支持preL)。

This is happening because on L, shadows are outside the the View bounds but pre-L, they are inside the View (unfortunately there is no real shadow support pre-L).

如果你想CardView有对L-相同的间距,以及,设置<一个href="https://developer.android.com/reference/android/support/v7/widget/CardView.html#attr_android.support.v7.cardview:cardUseCompatPadding">cardUseCompatPadding为true。

If you want CardView to have same spacing on L as well, set cardUseCompatPadding to true.

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

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