Cannot resolve class layer-list

399 views Asked by At

I tried creating a simple SplashScreen drawable resource file (.xml) with the following code:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
      <bitmap android:src="@drawable/android_red"
        android:gravity="center" />
    </item>
    <item android:top="10dp" android:left="10dp">
      <bitmap android:src="@drawable/android_green"
        android:gravity="center" />
    </item>
    <item android:top="20dp" android:left="20dp">
      <bitmap android:src="@drawable/android_blue"
        android:gravity="center" />
    </item>
</layer-list>

but it gives me the following errors:

Cannot resolve class layer-list Cannot resolve class item Cannot resolve class bitmap

Is layer-list a deprecated class?

I tried including version 7.3.1 libraries but that didn't solve it.

2

There are 2 answers

0
Timothy Sawe On

This only happens when creating your .xml under Layout rather than Drawable.

0
Khirokhito On

You need to just move your file from layout to drawable. It should fix the issue "Cannot resolve class item" "Cannot resolve class bitmap"