How can I resize ImageButton ? It show very big on screen . How I know it is an Actor and it is not resizing automatically . I can`t find the method for resizing it. Any ideas?

  • \$\begingroup\$ Take a look at this UI test: github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/… \$\endgroup\$ – ashes999 Aug 4 '14 at 9:36
  • \$\begingroup\$ shall I use stage.getViewport().update(width, height, true); ? \$\endgroup\$ – Vahe Muradyan Aug 4 '14 at 9:48
  • \$\begingroup\$ I'm not sure, sorry. \$\endgroup\$ – ashes999 Aug 4 '14 at 13:49
  • \$\begingroup\$ If I knew, I would post a proper answer :) take a look at the sample (test) I linked, it should hopefully work well for you, and you can post your solution when you figure it out. I didn't see any obvious way to resize the button either and I don't use Actor2d.ui. \$\endgroup\$ – ashes999 Aug 4 '14 at 15:26
  • \$\begingroup\$ and what are you using for buttons that contain only image? \$\endgroup\$ – Vahe Muradyan Aug 5 '14 at 12:34

Put your ImageButton in a table. Set the size of it. Add the table as an actor in your stage.

Here is an example:

ImageButton. ImageButton Style btnStyle new ImageButton.ImageButtonStyle ();
btnStyle.up = skin.getDrawable ("your image");

btnB = new ImageButton (btnStyle);

stage.addActor ( table );

table.add (btnB).size (150, 200);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.