Image Button Resize problem


#1

So,

I have some image buttons which I am trying to add in my application.

I am using the setImages function to set the image button.
Once I resize the image to fit the desired dimensions, it does not scale properly.

I changed the y / x ratio of the image and tried again but it still does not scale properly.

Can someone explain why this might happen?


#2

What do you mean by “scale properly”?


#3

So, when I use setBounds() for the image to fit the image according to the dimensions I desire, the image I use does not adhere to the width and height I specify in the code.


#4

The button scales the image inside it with a bit of padding, and keeps the proportions correct. Not sure exactly what you were expecting it to do, but there’s nothing wrong with it, it works the way it was intended.

If you have some specific way that you want your image scaled, then draw it yourself, don’t use ImageButton!