如何使CardView具有可点击和可检查的效果,以及如何使其成为深色主题? [英] How to make a CardView have a clickable&checkable effect, and how to make it dark themed?

查看:164
本文介绍了如何使CardView具有可点击和可检查的效果,以及如何使其成为深色主题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在引入CardView之前,我在 我的应用 来模仿卡片,并让用户还选择该应用要使用的主题(有些用户喜欢深色主题):

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) :

我想让它看起来更自然,因此我尝试使用CardView.

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

遗憾的是,我无法理解如何将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.

  1. 如何使CardView具有可点击的效果?在棒棒糖上,这是一种涟漪效应.在以前的版本中,它的全色在CardView的边界内变化.我还想自定义可点击效果的颜色,并使其也可检查.

  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.

如何制作深色主题CardView?

How do I make a dark-theme CardView ?

推荐答案

深色主题的CardView必须使用CardView.Dark样式.您也可以只使用此错误.

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.

这篇关于如何使CardView具有可点击和可检查的效果,以及如何使其成为深色主题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆