2015-06-01 30 views
0

我有以下XML文件中,我得到這個錯誤:問題,在我的XML文件中缺少屬性

我的XML文件:

<?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> 

錯誤看截圖下方也 ): enter image description here

'layer_height'&'layout_width'屬性甚至不在XML中 - 這些在哪裏錯誤甚至來自?

enter image description here

回答

0

由於這個XML沒有定義佈局,所以您應該將其移動到它所屬的位置,或許可以在資源中繪製文件夾,並且警告將消失。

+0

是的,需要它在drawables中。謝謝。 – user1406716

0

的XML似乎是有效的(在良好形成的意義上),但語義(在Android的佈局邏輯感),它有一些警告/錯誤。你的智能IDE告訴你什麼可能是錯的。