Android Studio is turning white colors into black in dark mode

Viewed 962

Since yesterday my app automatically changes the colours from white to black when i am in dark mode. How can I turn it off?

My other apps work as usual.

My style.xml is the same as in my other apps:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/black</item>
    <item name="colorPrimaryDark">@color/black</item>
    <item name="colorAccent">@color/black</item>
</style>

And my layout is the following:

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:background="@android:color/white">

</FrameLayout>

what it looks like on device

what it should look like

1 Answers

I had the same problem and solved it by:

  1. create values-night directory besides values directory
  2. copy themes.xml from values directory to values-night directory
Related