I'll toss out what works for me.  The first thing I see is that I use
ImageButton instead of just Button

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android";>
<item android:state_window_focused="false" android:state_enabled="true"
android:drawable="@drawable/about_btn_normal" />
<item android:state_window_focused="false" android:state_enabled="false"
android:drawable="@drawable/about_btn_normal" />
<item android:state_pressed="true"
android:drawable="@drawable/about_btn_pressed" />
<item android:state_focused="true" android:state_enabled="true"
android:drawable="@drawable/about_btn_pressed" />
<item android:state_enabled="true"
android:drawable="@drawable/about_btn_normal" />
<item android:state_focused="true"
android:drawable="@drawable/about_btn_normal" />
<item android:drawable="@drawable/about_btn_normal" />
</selector>

* *<ImageButton
         android:layout_gravity="center"
         android:id="@+id/continue_button"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:adjustViewBounds="true"
     android:background="#0c3d97"
     android:src="@drawable/start_btn"
     android:onClick="startGame"
          />

On Thu, Mar 25, 2010 at 8:56 AM, intbt <[email protected]> wrote:

> I am getting an error from Eclipse when I use this xml file (res/
> drawable/btnswitch.xml) to designate different button conditions
>
> <?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/btn_st_rd" /> <!-- pressed -->
>     <item android:state_focused="true"
>           android:drawable="@drawable/btn_st_gr" /> <!-- focused -->
>     <item android:drawable="@drawable/btn_st_gr" /> <!-- default -->
>     </selector>
>
> I call it in my layout file with this code:
>
>        <Button
>        android:id="@+id/startTimer_btn"
>        android:src="@drawable/btnswitch""
>        android:layout_width="wrap_content"
>        android:layout_height="fill_parent"
>
>
>        />
>
> Eclipse says it can't run the configuration because I have errors but
> does not show any errors. And when I remove the xml code (to go back
> to my original code which just sets a background image for the Button)
> it says that now has errors. I have to restart Eclipse to get the
> original code to run again.
>
> Any ideas as to what I am missing?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
> To unsubscribe from this group, send email to android-developers+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>



-- 
Writing code is one of few things
that teaches me I don't know everything.

Make Call Girl Manager great!
Join the forums.
http://www.fuligin.com/forums

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to