- 1.主要是以下这个属性
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
- 2.完整的代码
<?xml version="1.0" encoding="utf-8"?> <resources xmlns:tools="https://schemas.android.com/tools"> <!-- Base application theme. --> <style name="Theme.Base" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge"> <!-- Primary brand color. --> <item name="colorPrimary">@color/color_F3F3F1</item> <item name="colorPrimaryVariant">@color/color_F3F3F1</item> <item name="colorOnPrimary">@android:color/black</item> <item name="android:forceDarkAllowed" tools:targetApi="q">false</item> <!-- Secondary brand color. --> <item name="colorSecondary">@color/color_FFC01F</item> <item name="colorSecondaryVariant">@color/color_FFC01F</item> <item name="colorOnSecondary">@android:color/white</item> <!-- Status bar color. --> <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> <!-- Customize your theme here. --> <item name="android:windowBackground">@color/color_F3F3F1</item> <item name="colorControlActivated">@color/color_FFC01F</item> </style> </resources>
- 3.然后在manifest的application标签下设置android:theme="@style/Theme.Base"
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/addevelopment/889678.html