Search code examples
androidandroid-xmlandroid-attributes

Issue with missing attribute in my XML file


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


Solution

  • 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.