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

2189 questions
308
votes
26 answers

RecyclerView inside ScrollView is not working

I'm trying to implement a layout which contains RecyclerView and ScrollView at the same layout. Layout template: ... …
213
votes
14 answers

Ripple effect on Android Lollipop CardView

I'm trying to get a CardView to display the ripple effect when touched by setting the android:backgound attribute in the activity XML file as described here on the Android Developers page, but it isn't working. No animation at all, but the method in…
161
votes
6 answers

CardView background color always white

I am using RecyclerView with GridLayoutManager and I have each item as CardView. Unfortunately, the CardView here does not seem to change its background color. I tried in layout and programmatically as well but I have tried nothing seems to work. I…
Ishaan
  • 3,009
  • 2
  • 19
  • 34
144
votes
18 answers

Change the background color of CardView programmatically

The CardView has an attribute card_view:cardBackgroundColor to define the background color. This attribute works fine. At the same time there isn't a method to change the color dynamically. I've just tried solutions…
Gabriele Mariotti
  • 192,671
  • 57
  • 469
  • 489
129
votes
10 answers

CardView layout_width="match_parent" does not match parent RecyclerView width

I have a fragment with contains a RecyclerView with layout_width="match_parent":
128
votes
19 answers

CardView not showing Shadow in Android L

My Cardview inside Listview is not showing shadow in Android L(Nexus 5). Also the round edges are not properly shown. Here is the code for Listview's Adapter View :
104
votes
13 answers

CardView Corner Radius

Is there a way to make CardView only have corner radius at the top?
squeeish
  • 2,852
  • 4
  • 27
  • 39
95
votes
6 answers

Setting Elevation in XML on AppCompat CardView on Android 5.0

From what I understand, early in the preview stage there seemed to be no way to set elevation in XML only on CardViews without a hack in Java. Now that the official release is out, is there any way of doing this in XML without writing Java code to…
91
votes
6 answers

Transparent background on CardView - Android

I want to do transparent background on CardView. I know backgroundColor but i have image on my Layout. Do you know how do it? Or something which work as cardview but i will set a transparent background? Regards
mac229
  • 2,567
  • 3
  • 13
  • 23
84
votes
7 answers

Programmatically set '?selectableItemBackground' on Android view

In xml, I often do this to emulate onClick effect:
Hendra Anggrian
  • 5,181
  • 12
  • 51
  • 93
83
votes
13 answers

How to know when the RecyclerView has finished laying down the items?

I have a RecyclerView that is inside a CardView. The CardView has a height of 500dp, but I want to shorten this height if the RecyclerView is smaller. So I wonder if there is any listener that is called when the RecyclerView has finished laying down…
wm1sr
  • 1,427
  • 1
  • 13
  • 18
80
votes
12 answers

How to disable the shadow around card view in android

Hello I am am working on demo application in which i am using the card view of support library. By default it is adding shadow around it. I want to remove this shadow & should looks like simple. I tried this that is not working for me. CardView…
N Sharma
  • 28,073
  • 81
  • 228
  • 405
79
votes
4 answers

Why there is no space between CardViews on Lollipop?

I try to use the CardView and it works well below 5.0, but looks strange on Lollipop.
cajsaiko
  • 1,003
  • 1
  • 8
  • 15
73
votes
4 answers

How to set the padding for CardView widget in Android L

I'm using android:paddingLeft and android:paddingTop to set the padding for the new CardView widget but it doesn't work. I can set the margin for all the controls inside the CardView as a workaround but that's a pain if there are too many controls.…
nomongo
  • 3,315
  • 7
  • 28
  • 33
69
votes
8 answers

How to add colored border on cardview?

I am new to Android and this is my first question here. I am trying to add a colored vertical border at the beginning of the cardview. How can I achieve it on xml ? I tried adding it with empty textview but it is messing up the whole cardview…
George Forster
  • 691
  • 1
  • 6
  • 5
1
2 3
99 100