Can anyone please advise me how to style a ScaleImageButton so that a semi-transparent overlay is displayed over the image to show the button is pressed (similar to that of a Button)?
My ScaleImageButton is declared as follows:
Image i = ....
ScaleImageButton photoButton = new ScaleImageButton(i);
photoButton.setBackgroundType(Style.BACKGROUND_IMAGE_SCALED_FILL);
I tried to add some style for when it is pressed:
photoButton.getPressedStyle().setBackgroundType(Style.BACKGROUND_NONE);
photoButton.getPressedStyle().setBgColor(0xFFFFF0);
photoButton.getPressedStyle().setBgTransparency(50);
Styles like Style.BACKGROUND_NONE
will effectively disable the button. Notice that this method was designed to apply to all styles as the very idea of the class is to display a scaled image.
BGColor has no impact when an image is set since that would be redundant as the image is drawn. BGTransparency only applies to solid colors not to images.
Also notice that the value for bgTransperency and opacity isn't percentage. It's a value between 0 and 255.
You can probably accomplish what you're trying to do with:
photoButton.getPressedStyle().setOpacity(100);