Hi all,
I have a Dialpad in which there are multiple buttons. Whenever a button is clicked a sounds plays and the background of the imagebutton is changed.
For this I'm using
And the XML for the button is as follows:
I also have an onKeyDown(...) method for playing the sound, but I'm not able to get the imagebutton to switch background on the click...So my question is how to change the imagebutton's background when the onkeydown method is used?
Any tips would be appreciated...
I have a Dialpad in which there are multiple buttons. Whenever a button is clicked a sounds plays and the background of the imagebutton is changed.
For this I'm using
PHP:
ImageButton zero = (ImageButton) findViewById(R.id.btnZero);
zero.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
playSound(R.raw.mamacita_zero);
}
});
PHP:
<?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/green0" /> <!-- pressed -->
<item
android:drawable="@drawable/blue0" /> <!-- default -->
</selector>
Any tips would be appreciated...