2015-02-06 112 views
0

我有一個很大的控制檯,裏面充滿了錯誤,所有相同的錯誤。「沒有發現與給定名稱匹配的資源」

[2015-02-07 08:33:42 - TheHunter] C:\Users\Windows 8\workspace\TheHunter\res\drawable-hdpi\custom2.xml:4: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/button2'). 

[2015-02-07 08:33:42 - TheHunter] C:\Users\Windows 8\workspace\TheHunter\res\drawable-hdpi\custom3.xml:4: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/button3'). 

我有這些相同的錯誤,但在我的控制檯大約100次不同的圖像。 這只是我的主頁的代碼的一點點,我有幾個按鈕和圖像正在使用,但保持所有相同的錯誤。由於這些錯誤,我看到它只是不允許我在android模擬器中使用應用程序的所有圖像。

請問您爲什麼會收到這些錯誤?謝謝。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/background" 
    tools:context="com.application.thehunter.MainActivity" > 

    <ImageButton 
     android:id="@+id/imageButton1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginTop="74dp" 
     android:contentDescription="TODO" 
     android:background="@drawable/custom1" 
     android:src="@drawable/Button1" 
     tools:ignore="HardcodedText,ContentDescription" /> 

    <ImageButton 
     android:id="@+id/imageButton2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/imageButton1" 
     android:contentDescription="TODO" 
     android:background="@drawable/custom2" 
     android:src="@drawable/Button2" 
     tools:ignore="HardcodedText,ContentDescription" /> 

回答

1

資本是問題的一部分。資源名稱必須是以字母開頭的小寫字母,數字或下劃線。再仔細檢查一下,你是否確實有文件命名。

相關問題