How to set Background Color for Material3 Card in Android Compose?
Piggy backing fro this question. The answers tells how to set a background color. When material3 card is pressed, it changes color with a ripple effect. But how can I change the effect color when it is pressed?
CardDefaults.cardColors(....)
doesn't do it
The
Card
with theonClick
variant uses internally anindication = rememberRipple()
. This creates and remembers a Ripple using values provided byRippleTheme
.You can provide a custom
LocalRippleTheme
to override the default behaviour:with:
Otherwise you can use the
clickable
modifier:Finally if you want to modify the background color when the Card is pressed (not the ripple effect) you can use: