Using RecyclerView with Card

后端 未结 3 1762
醉话见心
醉话见心 2021-02-13 19:01

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 p

3条回答
  •  北海茫月
    2021-02-13 19:23

    I had the same problem. I had to create a layout-v21 folder, which will be used by lollipop devices, and duplicate the layout adding the margin/padding I needed to space it out correctly.

    That way when your app is launched on lollipop the layout will be read in from the layout-v21 folder with the correct space added, and any other device will go to your standard layout file where the space isn't needed to be explicitly set.

    Hope this helps.

提交回复
热议问题