1. Check out our app, Forums for Android! Download and leave feedback here!

ImageButton Issues

Discussion in 'Application Development' started by manurules3, Apr 30, 2010.

  1. manurules3

    manurules3 Member
    Thread Starter
    15

    Apr 4, 2010
    12
    0
    15
    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
    Code (Text):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <LinearLayout
    3.   xmlns:android="http://schemas.android.com/apk/res/android"
    4.   android:layout_width="wrap_content"
    5.   android:layout_height="wrap_content"
    6.   android:background="@drawable/background"
    7.   android:gravity="bottom|center"
    8.   android:paddingBottom="50px"
    9.   android:id="@+id/main_menu">
    10. [B]<ImageButton
    11.   android:layout_width="wrap_content"
    12.   android:layout_height="wrap_content"
    13.   android:id="@+id/playbutton"
    14.   android:src="@drawable/play_button"
    15.   android:background="@drawable/button_background"
    16.   />[/B]
    17. <Button
    18.   android:layout_width="wrap_content"
    19.   android:layout_height="wrap_content"
    20.   android:id="@+id/helpbutton"
    21.   android:background="@drawable/helpbutton"
    22.   />
    23. <Button
    24.   android:layout_width="wrap_content"
    25.   android:layout_height="wrap_content"
    26.   android:id="@+id/creditsbutton"
    27.   android:background="@drawable/creditsbutton"
    28.   />
    29.  
    30. </LinearLayout>
    31.  
    And here is the selector imagebutton xml...
    Code (Text):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <Selector
    3. xmlns:android="http://schemas.android.com/apk/res/android">
    4. <item
    5. android:state_pressed="true"
    6. android:drawable="@drawable/playbuttonpressed"
    7. />
    8. <item
    9. android:state_focused="true"
    10. android:drawable="@drawable/playbuttonover"
    11. />
    12. <item
    13. android:drawable="@drawable/playbutton"
    14. />
    15. </Selector>
    16.  
    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
     

    Advertisement

Share This Page

Loading...