Ich möchte einen Selektor in Android Studio erstellen. Ich habe eine Datei namens "button_hover.xml" im Ordner res.layout erstellt.Erstellen eines Selektors
button_hover.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="wrap_content" android:layout_width="wrap_content">
<item android:state_focused="true" android:drawable="@drawable/bg1.png"/>
<item android:state_pressed="true" android:drawable="@drawable/bg2.png" />
<item android:drawable="@drawable/bg3.png" />
</selector>
bg1.png, bg2.png, bg3.png in meinem ziehbar Ordner existiert, kann ich Strg + Leertaste, um sie zu nennen, aber wenn Ich starte die App, die Konsole zeigt den Fehler:
Error:(5, 58) No resource found that matches the given name (at 'drawable' with value '@drawable/bg1.png').
Error:(6, 58) No resource found that matches the given name (at 'drawable' with value '@drawable/bg2.png').
Error:(7, 29) No resource found that matches the given name (at 'drawable' with value '@drawable/bg3.png').
Wie kann ich das beheben?
Verwendung '@ ziehbar/bg1' statt, verlieren die' .png' – eriuzo
entfernen .png Erweiterung von wo das Zeichen verwendet wird –