manurules3
Newbie
Ok, so when I'm using ImageButton in my xml, and i keep encountering problems when lauching and the console in eclipse says Unable to resolve drawable "....res/drawable/play_button.xml" in attribute "src". Heres my xml code
And here is the selector imagebutton xml...
I'm really confused with this error. I used the sdk example and i still get force closes when starting the activity with this menu. Any ideas/solutions? Thanks in advance
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/background"
android:gravity="bottom|center"
android:paddingBottom="50px"
android:id="@+id/main_menu">
[B]<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/playbutton"
android:src="@drawable/play_button"
android:background="@drawable/button_background"
/>[/B]
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/helpbutton"
android:background="@drawable/helpbutton"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/creditsbutton"
android:background="@drawable/creditsbutton"
/>
</LinearLayout>
Code:
<?xml version="1.0" encoding="utf-8"?>
<Selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/playbuttonpressed"
/>
<item
android:state_focused="true"
android:drawable="@drawable/playbuttonover"
/>
<item
android:drawable="@drawable/playbutton"
/>
</Selector>