Search code examples
androidandroid-layoutandroid-listviewandroid-5.0-lollipopandroid-cardview

CardView attributes are not working with ListView


I am trying to use ListView with CardView while my code is working fine and i can see a CardView in ListView but CardView elevation and padding is not working while it is working with RecyclerView. Am i the only one or this is the case with everybody ? What am i doing wrong ? I've tried setting listview divider but elevation doesn't work not matter what attributes i use on ListView or CardView! I've tried the following

CardView elevation not working on Android 5.1.1 & Elevation not working


Solution

  • Take a look at this question and answer below. You'll get what you need.

    you should place your CardView within FrameLayout even i suggest you to use RecyclerView.