我正在使用 Material 主题。我希望我的应用程序仅使用浅色主题(目前我们没有任何深色模式计划)。有些设备会强制应用程序使用暗模式,我想避免这种情况。
我在 SO 上看到了这篇文章,不幸的是它对我不起作用。
那么,如何解决这个问题呢?
样式.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="materialButtonStyle">@style/ButtonTheme</item>
</style>
<style name="LandingTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/White</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:buttonStyle">@style/ButtonTheme</item>
</style>
</resoures>