ste*_*wpf 5 android themes material-components
我目前正在开始使用材质组件主题。入门指南提到了以下主题:
Theme.MaterialComponents
Theme.MaterialComponents.NoActionBar
Theme.MaterialComponents.Light
Theme.MaterialComponents.Light.NoActionBar
Theme.MaterialComponents.Light.DarkActionBar
Theme.MaterialComponents.DayNight
Theme.MaterialComponents.DayNight.NoActionBar
Theme.MaterialComponents.DayNight.DarkActionBar
Run Code Online (Sandbox Code Playgroud)
但没有对它们的描述。我在哪里可以找到有关这些主题的更多详细信息,或者有人可以在答案中解释它们吗?仅举个例子:
[..].NoActionBar?如果我不需要操作栏,我不会将其包含在我的布局文件中,所以我真的不明白这一点。Theme.MaterialComponents?或者我总是使用Theme.MaterialComponents.Lightor Theme.MaterialComponents.DayNight?我确信我无法详尽地回答您的所有问题,但我会分享一些想法,也许它会带您进一步迈出一两步:
\n\n\n\n\n[..].NoActionBar 是什么意思?
\n
如果您不希望运行时ActionBar向 中添加Activity,则应该使用以“.NoActionBar”结尾的主题(可能是因为您使用了 .NoActionBar)Toolbar。例如,如果您选择Theme.MaterialComponents.Light并使用 a Toolbar,您会注意到现在您的应用程序将使用两个ActionBars进行渲染
请注意,如果某个主题名为“MyTheme”,则该主题的前缀为“MyTheme”。将继承“MyTheme”的所有内容。所以几乎与除了 之外的Theme.MaterialComponents.Light.NoActionBar相同。Theme.MaterialComponents.LightActionBar
因此,如果您确实不想要任何版本,ActionBar则应该选择该.NoActionBar版本,并且Toolbar不要在布局文件中包含代理项 ( )。
\n\n\n这些主题定义了什么?只有颜色吗?文字风格?字体系列?
\n
他们这样做,但他们也定义了大小、边距和行为。除此之外,其中一些对于某些小部件有特殊的样式组合(例如style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"for TextInputLayout)
要深入了解主题会影响哪些属性,您可以查看theme_material.xml的源代码
\n\n\n\n\n我什么时候只使用 Theme.MaterialComponents?或者我总是使用 Theme.MaterialComponents.Light 或 Theme.MaterialComponents.DayNight?
\n
由于Theme.MaterialComponents是 的父主题Theme.MaterialComponents.Light,因此它们有很多共同点。主要区别在于,第一个假设您的应用程序将具有深色背景(因此文本应为白色),而第二个将具有黑色文本并假设您的应用程序的背景为浅色。
一般来说,人们会尝试使用某个主题作为模板,然后可以/必须对其进行定制 - 例如使用特殊的强调色。
\n\n\n\n\n这些主题看起来怎么样?
\n
您可以通过在自己的小示例应用程序中从一种切换到另一种来获得总体思路。
\n\n确实没有单一的信息来源(又名 Android 主题圣经)。您已经找到了 material.io,但也许developer.android.com的样式和主题部分或DayNight \xe2\x80\x94 上的这篇博客文章向您的应用程序添加深色主题将会带来更多启发。
\n| 归档时间: |
|
| 查看次数: |
2552 次 |
| 最近记录: |