Questions tagged [materialcardview]
54 questions
23
votes
4 answers
How to remove ripple effect from MaterialCardVew?
How can I disable touch ripple effect of MaterialCardView?
Setting clickable attribute to false or playing with foreground and background attributes had no effect.
I'm using material support library version 1.1.0-alpha02.

Mahozad
- 18,032
- 13
- 118
- 133
8
votes
1 answer
How come the color I set for cardBackgroundColor isn't exactly the one that gets shown?
Background
I'm trying to prepare dark theme for an app, and one of the requirements is to have a specific color for cards and dialogs : #ff3c454c
The problem
Whether I set it by force ( app:cardBackgroundColor="#3c454c") , by reference (…

android developer
- 114,585
- 152
- 739
- 1,270
8
votes
3 answers
com.google.android.material.card.MaterialCardView not displaying in android studio 3.5.3
preview of design using xml is not showing com.google.android.material.card.MaterialCardView, but its shown when we install the app.

Abraham Mathew
- 2,029
- 3
- 21
- 42
8
votes
2 answers
How to remove MaterialCardView borders
I'm using this layout

Elad Benda
- 35,076
- 87
- 265
- 471
4
votes
1 answer
Why setting shapeAppearanceModel in MaterialCardView stops childclipping?
My usecase is to edit shapeAppearanceModel for com.google.android.material.card.MaterialCardView
card.shapeAppearanceModel = card.shapeAppearanceModel
.toBuilder()
.setTopEdge(TriangleEdgeTreatment(triangleSize))
…

Anmol
- 8,110
- 9
- 38
- 63
4
votes
1 answer
Setting "outside" bottom edge for MaterialCardView doesn't work as expected
I'm trying to build a tooltip with shadow like the following image:
I was able to do so by using an Image as background. But I couldn't apply shadows to it. So, after searching I found this article, it uses MaterialCardView and applying…

Mohamed Nageh
- 1,963
- 1
- 19
- 27
4
votes
3 answers
Unable to inflate MaterialCardVIew class in Instrumental test
I am trying to test my recyclerView which and I'm using material card view for items display, and while the app works fine, i get this error when I'm trying to test:
android.view.InflateException: Binary XML file line #11: Binary XML file line #11:…

Amin Keshavarzian
- 3,646
- 1
- 37
- 38
3
votes
1 answer
MaterialCardView change background color and stroke color programmatically
Pro devs. I'll try to change the card view background and stroke color programmatically but all times card.setCardBackgroundColor() override the stroke color. Statically in XML, it works well. But programmatically it make an effect like this.
val…

billy gates
- 188
- 3
- 16
3
votes
1 answer
Android textIsSelectable stops TextView onClick working correctly
In my current Android application I have a MaterialCardView that wraps a TextView that I wish to be copyable e.g. I use
android:textIsSelectable="true"
However, I also need to know when the MaterialCardView is clicked as its within a RecyclerView…

Hector
- 4,016
- 21
- 112
- 211
3
votes
3 answers
How to change background color of CardView depending if is selected or not?
I'm trying to change the color of a CardView depending if is selected or not
I tried this, this is my card_view_color.xml:
-

haagantos
- 31
- 1
- 3
3
votes
1 answer
Android MaterialCardView cut corner style
I used a MaterialCardView
I've given it a Cut Corners style
But the views are far from the corners
IMAGE: Image spacing
It also I used the following code:
app:cardPreventCornerOverlay="true"
But it does not clip the corner
IMAGE: not croped…

Mohammad ali Riazati
- 43
- 5
3
votes
2 answers
MaterialCardView: Can't set checked state in xml layout
Android Studio 3.6
In xml layout I has this:

Alexei
- 14,350
- 37
- 121
- 240
2
votes
1 answer
MaterialCardView with top rounded corners should clip children
MaterialCardView clips its children when using rounded corners. If I use cardCornerRadius = true (which rounds all 4 corners of the card), the clipping behaves as expected -> children are not being drawn outside of the rounded area. If I try to…

DoruAdryan
- 1,314
- 3
- 20
- 35
2
votes
3 answers
CardView or MaterialTextView OnClickListener not working
I have cardview and material textview used inside LinearLayout layout like below

Riya Shah
- 155
- 1
- 12
2
votes
2 answers
Android Material CardView with ConstraintLayout clip child not working
I want to overlap (take half the image outside) of the card view. The ShapeableImageView is a child of the card view.
I have tried adding clipChilder="false" on card view as well as on the child constraint layout but no luck. I also tried the same…

Code Lover
- 8,099
- 20
- 84
- 154