我试图为我的应用程序添加一个夜间主题,而我却浪费了将近三个小时,只是试图使导航抽屉中的文本和图标与深色背景一起变成白色。这是我尝试在onCreate()中执行此操作的方法MainActivity.java: navigationView = (NavigationView) findViewById(R.id.navigation_view); navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { // This method will trigger onItemClick of navigation menu @Override public boolean onNavigationItemSelected(MenuItem menuItem) { // Checking if the item is in checked state or not, if not make it in checked state if (menuItem.isChecked()) menuItem.setChecked(false); else menuItem.setChecked(true); if (nightMode == 0) …