I use Theme.AppCompat.DayNight.NoActionBar
theme for my app. When I load adMob interstital some colors are broken in \"night\" mode (i.e. in RecyclerView).
The issue is supposedly caused by the WebView
resetting the UI mode, and this can be worked around by instantiating WebView
manually.
I haven't seen the issue after doing this (in Application.oncreate()
in this particular app):
if (nightMode != AppCompatDelegate.MODE_NIGHT_NO) {
Log.d(TAG, "Manually instantiating WebView to avoid night mode issue.");
try {
new WebView(getApplicationContext());
} catch (Exception e) {
Log.e(TAG, "Got exception while trying to instantiate WebView to avoid night mode issue. Ignoring problem.", e);
}
}
AppCompatDelegate.setDefaultNightMode(nightMode);
Source: https://groups.google.com/forum/#!msg/google-admob-ads-sdk/OZzHq_-wAFY/K50jClZcBAAJ