Image LibGDX ImageButton not scaled?

screenshot of image

The red square is the border of the button, and the image remains in the center of 32x32px. I tried using button.getImage () to set the position and size for the button values, but this has no effect.

+4
source share
2 answers

Just use regular Button. It also contains Drawablefor the background, but it is always stretched to fill the button. See JavaDoc forImageButton :

... , - , Button.ButtonStyle.up, Button.ButtonStyle.down Button.ButtonStyle.checked .

, ; Drawable .

+5

, , :

yourButton.getImage().setFillParent(true);
+2

Source: https://habr.com/ru/post/1531986/


All Articles