My light mode image appears but when I use another image for dark mode, my dark mode page turns black with everything in it. I’ll share my xml here for better understanding:
bg_light_layer xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable= "#ffd3b4"/>
<item>
<bitmap
android:src="@drawable/bg_light"
android:gravity="fill"
android:alpha=".6">
</bitmap>
</item>
</layer-list>
theme xml: (light mode)
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="SCREEN">
<item name="android:background">@drawable/bg_light_layer</item>
</style>
</resources>
activity_main xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp"
style="@style/SCREEN"
tools:context=".MainActivity">
(https://i.sstatic.net/7OTmsfeK.jpg)
(https://i.sstatic.net/D5cdXe4E.png)
I used ‘bg_light.png’ for light mode and ‘bg_dark.png’ for dark mode with EXACT SAME CODE replacing bg_light.png with bg_dark.png in bg_dark_layer xml then theme xml (dark). BUT my entire dark mode turns black screen when I do this. Note: I kept the images in res/drawbable, bg_light_layer and dark layer in res/drawable and themes light and dark in res/values (as default). I also tried multiple images for dark theme but didn’t work.
Death_stroke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.