Hamstersztyk Hamstersztyk - 1 month ago 7x
Android Question

Cannot set dark app theme Android Studio

I was trying to set dark background in theme like this -

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorBackground">@color/background_material_dark</item>
<item name="android:textColorPrimary">@color/abc_primary_text_material_dark</item>

It is working on Android Lollipop, Marshmallow and Nougat, but on KitKat and older systems, the background is white. Could someone help me? (I want to keep ActionBar too)


What you're using is android:colorBackground, to change the Window Background you must also add android:windowBackground to the same value.