某些设备,例如Poco F2 Pro,可以在与深色主题不兼容的应用程序中强制使用深色主题。
例如,我的应用程序有这个主题,并且与深色主题不兼容:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
这是我的清单应用程序部分,没有启用深色主题:
<application
android:name=".helpers.CustomApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:largeHeap="true"
android:theme="@style/AppTheme">
问题是像Poco F2 Pro这样的设备在应用程序中强制使用深色主题时,会使我的应用程序以不正确和异常的颜色显示,从而破坏 UI。
可以避免吗?
如何强制使用深色主题:https ://www.androidauthority.com/android-q-force-dark-mode-984090