Android Question Button SetBackgroundImage Changing Image Size

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I used Designer to add a button with a bitmap setting the Gravity as Center. The button space is bigger then the bitmap so designer does not fill the space (this is exactly what I wanted).

When I change the bitmap in code using SetBackgoundImage the button space is completely filled with the image.

In designer I have 3 choices: Fill, Center, Top-Left

In code I have tried: Pins(PinEntry).Gravity = Bit.OR(Gravity.CENTER_VERTICAL, Gravity.CENTER_HORIZONTAL) to try and stop the button from filling the entire space (on in my case it expands the bitmap image to fill the button - distorting the image).

How can I change the BackgroundImage and get the same result Designer gave me with Center (not filling the space)?

Thanks

BobVal
 
Top