質問

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.

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top