Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a CardView have a clickable&checkable effect, and how to make it dark themed?

Background

Before CardView was introduced, I made some selectors on my app to mimic cards, and let the user also choose which theme to use for the app (some prefer a dark theme) :

enter image description here

The problem

I wanted to make it look&work more natively, so I tried using CardView.

Sadly, I fail to understand how to set the CardView have a clickable&checkable effect (the native one of each platform, maybe with a different color), and also have the ability to set it a dark theme.

The questions

  1. How do I make a CardView have a clickable effect? On Lollipop it's a ripple effect. On previous ones it's full color changing within the boundaries of the CardView. I'd also like to customize the color of the clickable effect, and let it also be checkable.

  2. How do I make a dark-theme CardView ?

like image 382
android developer Avatar asked Jan 30 '26 02:01

android developer


1 Answers

You have to use the CardView.Dark style for the dark-theme CardView. You can also just use the colors as mentioned in the 11th and 12th comments of this bug.

like image 144
Zomb Avatar answered Jan 31 '26 19:01

Zomb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!