Java Libgdx表结构
我的代码Libgdx上的表属性有问题:Java Libgdx表结构,java,libgdx,Java,Libgdx,我的代码Libgdx上的表属性有问题: Table root = new Table(); root.setFillParent(true); stage.addActor(root); Table table = new Table(MyGdxGame.gameSkin); table.setBackground(new NinePatchDrawable(getNinePatch(("background.jpg")))); root.add(t
Table root = new Table();
root.setFillParent(true);
stage.addActor(root);
Table table = new Table(MyGdxGame.gameSkin);
table.setBackground(new NinePatchDrawable(getNinePatch(("background.jpg"))));
root.add(table).grow().pad(25.0f);
Label label = new Label("Marsel\nTale", MyGdxGame.gameSkin, "title");
label.setColor(Color.WHITE);
label.setScale(.9f,.9f);
table.add(label);
table.row();
TextButton playButton = new TextButton("Tournament",MyGdxGame.gameSkin);
playButton.addListener(new InputListener(){
@Override
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
game.setScreen(new ChampionScreen(game));
}
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
return true;
}
});
table.add(playButton);
TextButton optionsButton = new TextButton("Options",MyGdxGame.gameSkin);
optionsButton.addListener(new InputListener(){
@Override
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
game.setScreen(new OptionScreen(game));
}
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
return true;
}
});
table.add(optionsButton).padBottom(3.0f);
我无法修改表格的结构,我想将playButton和optionButton放在底部。应该有一种称为“底部”的方法,可以在按钮上使用,如:
table.add(playButton).bottom();
更多信息可以在这篇有帮助的文章中找到:用图片表达你的愿望