android - Theme.MaterialComponents.DayNight 未找到

标签 android xml material-design material-components-android

在我的 build.gradle 中,我包含了 Material 设计库(版本 1.1.0),但在 styles.xml 中, 当我尝试使用 Theme.MaterialComponents.DayNight ,上面写着 cannot resolve symbol . Material 设计库 1.1.0 中不是已经实现了 DayNight 主题吗?请帮忙。谢谢。

最佳答案

使用最新版本

implementation 'com.google.android.material:material:1.2.0-alpha03'

样式.xml
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

关于android - Theme.MaterialComponents.DayNight 未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59495906/

相关文章:

android - PopupWindow 的宽度/样式问题

android - Activity 中的空指针异常

android - 仅限wifi通讯

Android:Afollestad Material Dialog 操作按钮文本颜色

Android:在 MaterialTheme 中使用自定义样式的 AlertDialog 抛出资源未找到异常

android - Urban Airship NPE

android - 针对 xsd 的 xml 模式转换问题在 android 应用程序中给出非法异常

python - 领域特定语言,标准文件格式

xml - 如何将所有 xml 节点与 cdata-section-elements 匹配

android - 如何让子ImageView采用父MaterialCardView的形状外观?