Maybe you should just simply use
button.setBackgroundDrawable(R.drawable.something)

In addition, you should also write a selector xml like this:
<?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/bt_back_selected" /> <!--
pressed -->
     <item android:state_focused="true"
           android:drawable="@drawable/bt_back_selected" /> <!--
focused -->
     <item android:drawable="@drawable/bt_back_default" /> <!--
default -->
 </selector>

On Dec 10, 1:24 pm, neuromit <[email protected]> wrote:
> I'm working on a basic media player and am having problems changing
> the drawable on the play pause button.  Here is the code I'm using:
>
> Drawable draw = getResources().getDrawable(R.drawable.play);
> playPauseBTN.setCompoundDrawablesWithIntrinsicBounds(draw, null, null,
> null);
>
> The code executes fine without any errors or exceptions. However, the
> icon completely disappears from the button and I'm left with a narrow
> empty button.   Any tips?

-- 
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

Reply via email to