当演员调整大小时是否有监听器?
Is there a Listener for when an actor gets resized?
我想知道是否有比我在下面的代码片段中编写的更简单的方法来执行调整大小的特定方法。
@Override
public void resize(int width, int height) {
stage.getViewport().update(width, height, true);
for (Table t : tabPane.tabs) {
resize(stage.getViewport().getWorldWidth(), t);
}
}
private void resize(float width, Group group) {
SnapshotArray<Actor> children = group.getChildren();
Actor[] arr = children.begin();
for (Actor a : arr) {
if (a instanceof SoundButton) {
((SoundButton) a).resized(width);
} else if (a instanceof Group) {
resize(width, (Group) a);
}
}
children.end();
}
提前致谢。
Actor class 有一个你可以覆盖的方法,叫做 sizeChanged
@Override
public void sizeChanged() {
// Add Your code here
}
我想知道是否有比我在下面的代码片段中编写的更简单的方法来执行调整大小的特定方法。
@Override
public void resize(int width, int height) {
stage.getViewport().update(width, height, true);
for (Table t : tabPane.tabs) {
resize(stage.getViewport().getWorldWidth(), t);
}
}
private void resize(float width, Group group) {
SnapshotArray<Actor> children = group.getChildren();
Actor[] arr = children.begin();
for (Actor a : arr) {
if (a instanceof SoundButton) {
((SoundButton) a).resized(width);
} else if (a instanceof Group) {
resize(width, (Group) a);
}
}
children.end();
}
提前致谢。
Actor class 有一个你可以覆盖的方法,叫做 sizeChanged
@Override
public void sizeChanged() {
// Add Your code here
}