Je souhaite créer un sélecteur dans Android Studio. J'ai créé un fichier nommé "button_hover.xml" dans le dossier res.layout.Création d'un sélecteur
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 est existait dans mon dossier drawable, je peux utiliser Ctrl + Espace pour les appeler, mais quand Je cours l'application, la console montre l'erreur:
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').
Comment puis-je résoudre ce problème?
utilisation '@ drawable/bg1' à la place, perdre la' .png' – eriuzo
supprimer l'extension .png d'où l'drawable utilisé –