Combine applyDayNight() with custom theme overlay?

  android, androidx, theme-daynight

In androidx you can easily toggle between day/night mode. E.g.:

<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
   <!-- attributes -->
</style>

And when toggling theme:

AppCompatDelegate.setDefaultNightMode(nightMode);
getDelegate().applyDayNight();

Now, let’s say I want to add a minor customization to either the day or the night theme:

<style name="LimeTheme" parent="AppTheme">
    <item name="colorPrimary">@color/lime1</item>
    <item name="colorPrimaryDark">@color/lime2</item>
    <item name="colorControlHighlight">@color/lime3</item>
</style>

How do I accomplish that?

Source: Android Questions

LEAVE A COMMENT