• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps need help changing image on button

In my xml layout I have a button and an image inside the button to the right.I used:

Code:
android:drawableRight="@drawable/checkmark

Let's say I want to change the image to an X and my button in my java code is named button1.How whould I change the image?I know how to change the background using:

Code:
button1.setBackgroundResource(R.drawable.X)

But I can't find out how to change the image to the right.
 
Yep wubbzy nailed it. The background of a button is a different layer than its drawable icon. Both can be changed via java but they behave differently when stretching and reacting to touch events ( I think)
 
Back
Top Bottom