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
47
votes
12 answers

Unable to get exact circle shape when using card view

I'm using card view for floating action button in android material design. I'm using following code for get the circle
Ayyappan
  • 1,275
  • 1
  • 11
  • 25
45
votes
5 answers

CardView with different corner radius

I have the following CardView and I want to set different radius for each corner in the card. Is it possible to change them by XML or programmaticaly? Thanks in advance.
45
votes
7 answers

How to implement setOnScrollListener in RecyclerView

How Do I show progress bar at bottom when user reached to items those are visible in a list. I have written a code in which i am getting data using web service, now i would like to populate partial records, because i have around 630 records in my…
43
votes
7 answers

how to set colored border on cardview

I am implementing card view but I can't find any border option to set a border on it. here is my card.xml:
42
votes
7 answers

Expand and collapse CardView

What is the proper way to expand a CardView?
Robert Vangor
  • 1,018
  • 1
  • 13
  • 24
41
votes
3 answers

What's the difference between the CardView from com.google.android.material and android.support.v7.widget

I'd like to know the difference between both widgets android.support.v7.widget.CardView which is added using Android Studio IDE components palette and com.google.android.material.card.MaterialCardView which is used on Material Design…
40
votes
11 answers

MaterialCardView crashes with material:1.1.0

I am using MaterialCardView as my cardview layout. Now, Android-studio started showing me that instead of current implementation "com.google.android.material:material:1.0.0", I should update to 1.1.0
39
votes
1 answer

How to change card_view:cardCornerRadius programmatically

In my project, I am using RecyclerView in my listing using CardView. In my listing I have to set the corner radius of CardView dynamically based on device. Is there any way to set cardview corner radius value dynamically? Thanks.
Faisal Ahsan
  • 928
  • 1
  • 12
  • 22
39
votes
4 answers

Unnecessary padding in CardView?

I have implemented CardView in my app and everything works fine except there is a little padding around the image if I put radius to the card. It appears like this: But in android docs and in this article the image takes the entire cardview, so…
Ram Patra
  • 16,266
  • 13
  • 66
  • 81
38
votes
1 answer

How to set card elevation in jetpack compose with Material3

I've created the simple card in jetpack compose, Here I set elevation but it shows a type mismatch. Card( shape = RoundedCornerShape(20.dp),elevation = 10.dp ) { Box(modifier = Modifier.height(200.dp)) { …
38
votes
5 answers

Android CardView with rounded corners displays grey corners

I'm inflating a custom layout with CardView inside the layout. The rounded corners are displayed as expected but I also get grey background behind the corners. The code is simple, uses a CardView with corner radius and a background color. I've…
Prasad Pawar
  • 1,606
  • 1
  • 15
  • 30
38
votes
5 answers

layout_margin in CardView is not working properly

I am playing with the new CardView, but the margins don't seem to be applying.
Eric Cochran
  • 8,414
  • 5
  • 50
  • 91
37
votes
18 answers

CardView not showing shadow elevation

I am working with cardviews but the problem is my CardView is not showing any elevation or shadow. I have already tried some of the methods suggested in stackoverflow answers like I have tried using elevation and shadow property. I have also tried…
Nikesh Patel
  • 521
  • 1
  • 5
  • 13
37
votes
5 answers

Center a CardView in a RecyclerView with only one element

I'm using a RecyclerView that contains CardViews with a TextView and a ImageView (Every card represents a city). I also have a onClickListener on every card that leads me to a list of museum in the city. (The RecyclerView is populated by an…
Roberto Aureli
  • 1,428
  • 2
  • 12
  • 23
37
votes
1 answer

What is the best practice to group items into CardView?

CardView usually used to decorate exactly one element. But sometimes you need to wrap into this widget several items. Like in Inbox app, for example. So what is the best way to do this? It can be implemented via custom LayoutManager or even custom…
bvitaliyg
  • 3,155
  • 4
  • 30
  • 46