咸鱼

咸鱼是以盐腌渍后,晒干的鱼

0%

Android Studio 创建项目的模块Theme

  • Theme.MaterialComponents
    基于 ​​Material Design 2 (MD2)​​,是早期版本的 Material Design 规范,强调卡片、阴影和明确的层级结构。

  • Theme.Material3
    基于 ​​Material Design 3 (MD3)​​,是更新的设计规范,强调动态颜色(Dynamic Color)、圆角设计、更柔和的阴影和现代化的组件样式。

特性 MaterialComponents.DayNight.DarkActionBar Material3.DayNight.NoActionBar
​Design 版本​ Material Design 2 (MD2) Material Design 3 (MD3)
​ActionBar​ 包含深色 ActionBar 无默认 ActionBar(需自定义)
​动态颜色支持​ 不支持 支持(需 API 31+)
​组件风格​ 传统阴影、直角 圆角、柔和阴影、动态主题
​推荐场景​ 传统应用,快速开发 现代化应用,Jetpack Compose 项目

Bottom Navigation Views Activity

Theme.MaterialComponents​基于 ​​Material Design 2 (MD2)​​,是早期版本的 Material Design 规范,强调卡片、阴影和明确的层级结构。
==所以不推荐用这个模板创建项目==

default

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.BottomNavigationViewsSample" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

night

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.FlexboxLayoutSample" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

EmptyViews Activity

default

1
2
3
4
5
6
7
8
9
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.EmptyViewsActivity2025" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>

<style name="Theme.EmptyViewsActivity2025" parent="Base.Theme.EmptyViewsActivity2025" />
</resources>

night

1
2
3
4
5
6
7
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.EmptyViewsActivity2025" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
</style>
</resources>

Basic Views Activity

default

1
2
3
4
5
6
7
8
9
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.BasicViewsActivity2025" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>

<style name="Theme.BasicViewsActivity2025" parent="Base.Theme.BasicViewsActivity2025" />
</resources>

v23

1
2
3
4
5
6
7
8
9
<resources xmlns:tools="http://schemas.android.com/tools">

<style name="Theme.BasicViewsActivity2025" parent="Base.Theme.BasicViewsActivity2025">
<!-- Transparent system bars for edge-to-edge. -->
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
</style>
</resources>

night

1
2
3
4
5
6
7
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.BasicViewsActivity2025" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
</style>
</resources>