Category : android-darkmode

I have application, which set mode dark mode in Application: AppCompatDelegate.setDefaultNightMode(isDarkModeOn() ? AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO); It works everywhere as expected, but only on Samsung S20 / Android 11 it sometimes mix light/dark theme for main activity. I found article which could explain it, but I am not sure who (Google or Samsung) fixed problem and ..

Read more

If I use forceDarkAllowed <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:forceDarkAllowed">true</item> the colors in Base.ThemeOverlay.AppCompat.Light will be switched. <style name="Base.ThemeOverlay.AppCompat.Light" parent="Platform.ThemeOverlay.AppCompat.Light"> <item name="android:windowBackground">@color/background_material_light</item> <item name="android:colorForeground">@color/foreground_material_light</item> <item name="android:colorForegroundInverse">@color/foreground_material_dark</item> <item name="android:colorBackground">@color/background_material_light</item> … <color name="background_material_light">@color/material_grey_50</color> … <color name="material_grey_50">#fffafafa</color> For example, background_material_light changes from #fafafa to #1C1C1C after dark mode is set. I used a color picker to find that out. ..

Read more

I am trying to understand why the ActionBar is styled differently in Light vs Dark themes. Below is a simple settings screen that can toggle between Light and Dark themes with identical themes. valuesthemes.xml <resources xmlns:tools="http://schemas.android.com/tools"> <!– Dark application theme. –> <style name="Theme.SettingsApplication" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <item name="colorPrimary">@color/blue_normal</item> <item name="colorPrimaryVariant">@color/blue_dark</item> <item name="colorOnPrimary">@color/white</item> <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> <item name="colorSurface">@color/red</item> ..

Read more

After creating a very basic Settings AppCompatActivity and PreferenceFragmentCompat to change the day/night mode of my application, but the light theme doesn’t seem to apply across the entire application. None of the icons in the rest of the application want to follow, and the radio buttons in the ListPreference dialog also seem to retain their ..

Read more