【问题标题】:Where can I find and modify the material color attributes in Android Studio as defined by the Material Design Guide?我在哪里可以找到和修改材料设计指南定义的 Android Studio 中的材料颜色属性?
【发布时间】:2019-02-17 05:02:56
【问题描述】:

参考the following Material design Guide

我想在我的应用中修改 12 种不同的颜色,例如主要变体、次要等。

但是,在 Android Studio 中,使用主题编辑器时,可修改的颜色列表与材料设计指南中指定的不同。无论我选择哪个主题都是如此。

Material Design 和 android studio 的 Theme Editor 中定义的 12 种颜色变体如下:

材质设计:

colorPrimary    
colorPrimaryVariant    
colorSecondary    
colorSecondaryVariant    
colorBackground    
colorError    
colorSurface     
colorOnPrimary  
colorOnSecondary      
colorOnBackground     
colorOnError       
colorOnSurface    

主题编辑器:

colorPrimary    
colorPrimaryDark    
colorAccent    
android:colorBackground     
android:colorForeground     
android:navigationBarColor       
android:statusBarColor    
android:textColorPrimary    
android:textColorPrimaryInverse    
android:textColorSecondary    
android:textColorSecondaryInverse    
android:windowBackground   

这些颜色只是同一事物的不同名称还是我只是看错了地方?我在材料设计文档中找不到任何与 android studio 中的名称相似的东西,所以我有点不确定。

任何指导将不胜感激!

【问题讨论】:

  • 您在此期间发现了吗?迁移到 androidx 后遇到了这个问题。
  • 目前似乎还没有这个,新的配色方案即将推出。所以在这一点上,配色方案与 AppCompat 主题几乎相同。
  • @drk 是的,我认为你是正确的,因为我从来没有弄明白。

标签: android colors material-design


【解决方案1】:

新的颜色属性在当前稳定版本 1.0.0 中不可用,但在最新的 1.1.0 alpha 中可用:

implement "com.google.android.material:material:1.1.0-alpha05"

文档先于实施。您可以查看发布日志以了解情况: https://github.com/material-components/material-components-android/releases

【讨论】:

    猜你喜欢
    • 2014-12-08
    • 2015-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-07
    • 2019-02-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多