2015-04-04 65 views
0

我在嘗試創建自定義按鈕時收到此錯誤消息,我已經嘗試了大多數類似於我的問題的答案,但無法使其工作。任何幫助非常感謝。另外,因爲這是我第一次在這裏發表,請原諒我,如果規則有任何問題。「解析XML時出錯:文檔元素後出現垃圾」

<?xml version="1.0" encoding="UTF-8"?> 
<RelativeLayout 
<Selector 
      xmlns:android="http://schemas.android.com/apk/res/android"> 
      <item android:drawable="@drawable/touchlighter" android:state_pressed="true"/> 
      <item android:drawable="@drawable/touch"/> 
</Selector> 
</RelativeLayout> 

回答

0

你鍵入<Selector ...其中<RelativeLayout>的屬性應該去。

我認爲正確的XML應該是:

<?xml version="1.0" encoding="UTF-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"> 
    <Selector> 
     <item android:drawable="@drawable/touchlighter" android:state_pressed="true"/> 
     <item android:drawable="@drawable/touch"/> 
    </Selector> 
</RelativeLayout> 
相關問題