Broken colors in DayNight Theme after loading Admob/Firebase ad

后端 未结 1 664
无人共我
无人共我 2020-12-14 23:20

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).

相关标签:
1条回答
  • 2020-12-15 00:10

    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

    0 讨论(0)
提交回复
热议问题