当一个人应该使用Theme.AppCompat VS ThemeOverlay.AppCompat? [英] When should one use Theme.AppCompat vs ThemeOverlay.AppCompat?

查看:1995
本文介绍了当一个人应该使用Theme.AppCompat VS ThemeOverlay.AppCompat?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有以下Theme.AppCompat类:

There are the following Theme.AppCompat classes:

Theme.AppCompat
Theme.AppCompat.Light
Theme.AppCompat.Light.DarkActionBar
Theme.AppCompat.NoActionBar
Theme.AppCompat.Light.NoActionBar
Theme.AppCompat.DialogWhenLarge
Theme.AppCompat.Light.DialogWhenLarge
Theme.AppCompat.Dialog
Theme.AppCompat.Light.Dialog
Theme.AppCompat.CompactMenu

和以下ThemeOverlay.AppCompat类:

and the following ThemeOverlay.AppCompat classes:

ThemeOverlay.AppCompat
ThemeOverlay.AppCompat.Light
ThemeOverlay.AppCompat.Dark
ThemeOverlay.AppCompat.ActionBar
ThemeOverlay.AppCompat.Dark.ActionBar

为什么总会有使用ThemeOverlay.AppCompat.light VS Theme.AppCompat.Light例如?我看到有对ThemeOverlay定义的少得多的属性 - 我很好奇的预期使用情况下ThemeOverlay是什么

Why would one use ThemeOverlay.AppCompat.light vs Theme.AppCompat.Light for example? I see that there are much less attributes defined for ThemeOverlay -- I am curious what the intended use case for ThemeOverlay is.

推荐答案

每本主题VS风格博客文章通过AppCompat的创建者:

Per this Theme vs Style blog post by the creator of AppCompat:

[ThemeOverlays]是特殊题材而覆盖正常Theme.Material主题,覆盖相关的属性,使他们无论是亮/暗。

[ThemeOverlays] are special themes which overlay the normal Theme.Material themes, overwriting relevant attributes to make them either light/dark.

ThemeOverlay +动作条

你的敏锐的眼睛也已经看到了动作条ThemeOverlay衍生物:

The keen eyed of you will also have seen the ActionBar ThemeOverlay derivatives:

      
  • ThemeOverlay.Material.Light.ActionBar
  •   
  • ThemeOverlay.Material.Dark.ActionBar
  •   
  • ThemeOverlay.Material.Light.ActionBar
  • ThemeOverlay.Material.Dark.ActionBar

这些只能通过新的 actionBarTheme 属性中使用的操作栏,或直接设置工具栏上。

These should only be used with the Action Bar via the new actionBarTheme attribute, or directly set on your Toolbar.

唯一的东西,这些目前做不同他们的父母,他们修改 colorControlNormal 安卓textColorPrimary ,从而使任何文字和图标不透明的。

The only things these currently do differently to their parents is that they change the colorControlNormal to be android:textColorPrimary, thus making any text and icons opaque.

这篇关于当一个人应该使用Theme.AppCompat VS ThemeOverlay.AppCompat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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