2013-07-05 15 views
1

在android開發中發生此錯誤「此項目無法訪問,因爲以前的項目(項目#1)是比這個」。這個項目是無法訪問,因爲以前的項目(項目#1)是比這一個更一般的匹配


<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
<item android:drawable="@drawable/button1"></item> 
<item android:state_pressed="true" 
    android:drawable="@drawable/buttonClick"></item> 
<item android:state_selected="true" android:drawable="@drawable/buttonSelect"></item> 
</selector> 

+0

我知道,選擇與他們的項目順序非常敏感,也許把第一個默認項目放到最後一個訂單。然後,最好定義一個press =「false」和selected =「false」的語句。 – Opiatefuchs

回答

0

你應該改變同一位置:

<item android:state_selected="true" android:drawable="@drawable/buttonSelect"></item> 
<item android:state_pressed="true" android:drawable="@drawable/buttonClick"></item> 
<item android:drawable="@drawable/button1"></item> 
相關問題