How to properly set elevation value to recyclerview?

后端 未结 4 1488
悲哀的现实
悲哀的现实 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:30

    For Lollipop and you can use the android:elevation property but below lollipop versions you have to give custom shadow so refer the below code for shadow

    card_background.xml

    
    
    
        
            
            
        
    
    
    
        
            
            
        
    
    
    

    Give this file as a background to your recyclerview inflater file it will work fine.

提交回复
热议问题