【发布时间】:2020-10-17 14:46:51
【问题描述】:
我正在使用 Material 主题。我希望我的应用程序仅使用浅色主题(目前我们没有任何深色模式计划)。某些设备会在应用上强制使用暗模式,我想避免这种情况。
我见过this post on SO,但不幸的是它对我不起作用。
那么,如何解决呢?
Styles.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>
【问题讨论】:
标签: android android-layout material-components-android android-darkmode