I am using a textbutton that changes its text from OFF to ON when you click on it. But once it does that the size is completely different. Is there a way to make the button keep its current size? I've tried setScale and setSize of the button but it does not seem to do anything. I am using the button in a table if that is relevant.
Asked
Active
Viewed 1,492 times
1 Answers
5
If you are using the table, you should change the size of the cell
instead.
For example, lets imagine that your code was:
TextButton btn = new TextButton(...);
btn.setSize(100, 100);
table.add(btn);
You should define it like this instead:
TextButton btn = new TextButton(...);
table.add(btn).size(100, 100); // <-- resize cell, not button
Please refer this document for more information.

desertkun
- 1,027
- 10
- 19
-
Wow..it was that simple? Now I feel silly xD. But thanks! Appreciate it! – Lucas Feb 04 '14 at 13:51
-
Also see this: http://stackoverflow.com/questions/15910879/slider-always-has-default-width/16021254#16021254 . – bemeyer Feb 04 '14 at 14:24