Search code examples
javaandroidandroid-studioandroid-activitysettings

Settings activity not supporting dark mode in Android Studio in Java


So I have a problem with the dark mode in my root_preferences.xml, when the phone is in light mode everything is visible, but when the user turns on dark mode and tries to change something in the settings, buttons "OK" and "CANCEL" change their color to dark gray and they are barely visible. The color of button text in my activity also changes color to dark gray but that's a different case it would be nice if someone would know the solution to this.

<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">

<PreferenceCategory app:title="Settings">

    <EditTextPreference
        android:key="weight"
        android:selectAllOnFocus="true"
        android:singleLine="true"
        android:title="Weight"
        android:summary=""/>


    </PreferenceCategory>


    </PreferenceScreen>

Dark Theme

Light Theme


Solution

  • So basically all you have to do is just go into themes and night theme and change primaryVariant color