Category : theme-daynight

I have an android application which uses material daynight theme. My App has the follow heirarchy: MainActivity->Activity A-> Activity B.(MainActivity creates A which creates B) Both Activity A and Activity B(not MainActivity) extend a BaseActivity which handles menuitem clicks. When the user is in Activity B and he changes the theme (option available as menu ..

Read more

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

Read more

I’m having trouble change app theme without activity restart. The project structure is like 1 main Activity and 5 Fragments inside it with bottomNavigationView; theme change toggle is in setting Fragment and other fragments contain list of data with different view types. styles.xml <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:windowBackground">@null</item> <item ..

Read more