Questions tagged [android-cardview]

CardView is a widget used to show complex lists and cards in your app, it has material design style by default.

CardView is a widget used to show complex lists and cards in your app, it has material design style by default. CardView extends the FrameLayout class and lets you show information inside cards that have a consistent look on any app. CardView widgets can have shadows and rounded corners.

Useful links

2320 questions
37
votes
11 answers

CardView inside RecyclerView has extra margins

I am using a CardView as element inside a RecyclerView. When doing so android automatically generates margins between the cardView and the screen and between different cardViews.
vj9
  • 1,546
  • 1
  • 11
  • 18
36
votes
4 answers

CardView goes on top of FrameLayout, but declared first

I have simple FrameLayout with support CardView as first item, and TextView as second, so TextView must be on top of inflated view. This works on pre-Lolipop but on 21+ card takes toppest place in layout, why that's so and how to fix this? Same…
34
votes
4 answers

Cardview - white border around card

I am using a cardview as the root of a custom view I am writing. I using the v7 support library. My XML looks like this:
TheMethod
  • 2,893
  • 9
  • 41
  • 72
34
votes
3 answers

Strange behaviour of images in RecyclerView

I am using android.support.v7.widget.RecyclerView to show simple items containing text and in some cases also images. Basically I followed the tutorial from here https://developer.android.com/training/material/lists-cards.html and just changed the…
33
votes
5 answers

Card_view material design

I am trying to use card_view. But it keeps giving an error. Error:(13) No resource identifier found for attribute `'cardCornerRadius' in package 'com.google.example.test_app'
32
votes
5 answers

Parent click event not firing when recyclerview clicked

I have a RecyclerView which is in a CardView that has a couple of TextViews. The CardView has a OnClickListener set and is fired off when clicking on the TextViews, but does not fire when clicking on the RecyclerView. Here is what the CardView…
Derek
  • 967
  • 1
  • 9
  • 16
32
votes
6 answers

Cardview shadow not appearing in lollipop devices?

Am using the cardview in my android app. However the shadow is not showing. Here is the xml layout The default optionsmenu shadow also not showing.
30
votes
4 answers

Android CardView with weird border when transparent

I'm having some trouble with CardView transparency and card_elevation. Trying to use a CardView transparent the result is: Without transparency: What I'm trying to get is something like this: Here is my xml:
Isquierdo
  • 745
  • 1
  • 10
  • 29
28
votes
4 answers

OnClickListener for CardView?

How do I attach an OnClickListener to a CardView? I want every single card to have a different action when clicked. I have a RecyclerView that has a custom adapter for displaying the cards. This is how it's implemented.
MikkoP
  • 4,864
  • 16
  • 58
  • 106
27
votes
6 answers

CardView: How do I add a gradient background while maintaining the radius

I want to re-create the image below with a CardView. To achieve this, I created a gradient file (btn_gradient.xml) and then proceeded to create the CardView. CardView implementation:
Taslim Oseni
  • 6,086
  • 10
  • 44
  • 69
27
votes
7 answers

No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating')

I am getting these two error messages when trying to compile: /Users/dericw/coding/myApplication/lfdate/android/app/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.2.1/res/values-v23/values-v23.xml Error:(3, 5) No resource found…
The Nomad
  • 7,155
  • 14
  • 65
  • 100
27
votes
2 answers

Why use a CardView instead of a RelativeLayout or LinearLayout?

I have a RecyclerView for displaying a list of items. There is this android CardView class given by android to show card layout. If I use a RelativeLayout and set its background to white it works the same way. Also in case of CardView I have to…
sanjeev
  • 1,343
  • 3
  • 16
  • 28
27
votes
4 answers

Drag and Drop between two RecyclerView

Is it possible to have feature like drag and drop between two different RecyclerView? I found library for drag and drop within RecyclerView. Please help me to improve this functionality.
ramji
  • 1,982
  • 2
  • 13
  • 13
26
votes
2 answers

CardView elevation not showing in lollipop and higher versions

I was using cardview, but the problem is elevation not showing in lollipop and higher versions. please suggest me.Here is my code.
25
votes
7 answers

CardView has extra margin in each edge on Pre-Lollipop

Here are two pictures. on Lollipop: on Pre-Lollipop: we can see that it's just close to the screen side on Lollipop. that's what I want. but on the Pre-Lollipop device, it has extra margin to the screen edge. do you guys have any experience ?…
Jaden Gu
  • 9,143
  • 3
  • 23
  • 26