【问题标题】:Using material design resources with AppCompat library将材料设计资源与 AppCompat 库一起使用
【发布时间】:2015-11-24 15:43:51
【问题描述】:

我正在使用 v21 之前的 SDK 构建我的新应用,这意味着我必须使用 AppCompat 库才能使用 Material Design 主题和控件。我对 Material 资源文件有疑问。

按照 Google 指南的建议,我应该更喜欢在我的应用中使用以下字体:https://www.google.ru/design/spec/style/typography.html#typography-styles 例如,对于标题,我应该更喜欢 20sp Roboto 字体。

这些样式已经在android-sdk\platforms\android-23\data\res\values\styles_material.xml中定义:

<style name="TextAppearance.Material.Title">
    <item name="textSize">@dimen/text_size_title_material</item>
    <item name="fontFamily">@string/font_family_title_material</item>
    <item name="textColor">?attr/textColorPrimary</item>
</style>

但是当我使用 AppCompat 库时,我似乎没有这些样式文件(为什么?)

如果我想遵循指南,我应该怎么做?如果我只是将这些样式复制粘贴到我自己的应用主题中会怎样?这是正确的方法吗?

【问题讨论】:

    标签: android layout android-5.0-lollipop material-design android-appcompat


    【解决方案1】:

    好的,我应该使用TextAppearance.AppCompat.Title 而不是TextAppearance.Material.Title。就是这样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-07
      • 1970-01-01
      • 2015-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多