How to properly set elevation value to recyclerview?

后端 未结 4 1463
悲哀的现实
悲哀的现实 2021-01-01 18:41

I am working on grid layout using recyclerview in android. The grid occupies a portion of the screen and has a shadow. To get the desired shadow effect I am using an elevati

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-01 19:22

    I found the answer after a little bit of searching from here. The problem was the transparent background. Elevation works with only non-transparent backgrounds on views. To fix it we should set android:outlineProvider="bounds" on the view and android:clipToPadding="false" on the view's parent.

    Hope it helps someone.

提交回复
热议问题