Issue with missing attribute in my XML file

400 Views Asked by At

I have the following XML file in which I am getting this error:

My XML File:

<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
  <shape android:shape="rectangle">
     <solid android:color="#CABBBBBB"/>
     <corners android:radius="5dp" />
  </shape>
</item>

<item
  android:left="5dp"
  android:right="5dp"
  android:top="5dp"
  android:bottom="5dp">
  <shape android:shape="rectangle">
     <solid android:color="@android:color/white"/>
     <corners android:radius="5dp" />
  </shape>
</item>
</layer-list>

Error Seen (Screenshot below too): enter image description here

'layer_height' & 'layout_width' attributes are not even in the XML - where are these errors are even coming from?

enter image description here

2

There are 2 best solutions below

0
On BEST ANSWER

Since this XML does not define a layout, you should move it to where it belongs, perhaps, drawables folder in resources, and the warnings will be gone.

0
On

The XML seems to be valid (in the sense of well-formed), but semantically (in sense of Android layout logic) it has some warnings/errors. Your intelligent IDE is telling you what might be wrong.