Stop the libgdx TextButton from changing size depending on text
java, libgdx, scene2d, size, user-interface
Solution
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.
Problem
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.