使用RecyclerView用卡RecyclerView、用卡

2023-09-06 03:42:31 作者:大化不争

我有卡项目的部分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-相同的间距,以及,设置cardUseCompatPadding为true。

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