我需要我的应用程序能够自动在夜间和白天模式之间切换。
根据文档,我可以像这样使用UiModeManager:
UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE);
uiModeManager.setNightMode(UiModeManager.MODE_NIGHT_YES);
然而,该应用程序没有使用带有“夜间”限定符的备选资源。我没有注意到应用程序实际上已经更改了配置。我该如何强制应用程序使用夜间限定的资源?
uiModeManager.enableCarMode(0);
并没有导致配置发生变化。应用程序仍然运行在"普通"的uiModeType中。感谢你的回答! - undefined