我在表中创建了菜单按钮。 我没有指向表格边框的任何位置,但它显示了。 我在模拟器中运行或在桌面模式下出现边框 也许我创建了错误的表?
@Override
public void show() {
table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
//Button PLAY
//скин кнопки плай
btnplayStyle = new ImageButton.ImageButtonStyle();
btnplayStyle.up = buttonsSkin.getDrawable("play");//кнопка не нажата
btnplayStyle.over = buttonsSkin.getDrawable("play");
btnplayStyle.down = buttonsSkin.getDrawable("play"); // кнопка нажата
playSkin = new ImageButton(btnplayStyle);
playSkin.setSize(300, 200);
stage.addActor(playSkin);
playSkin.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
game.setScreen(new GameScreen(game));
}
});
//Button score
btnscoreStyle = new ImageButton.ImageButtonStyle();
btnscoreStyle.up = buttonsSkin.getDrawable("records");//кнопка не нажата
btnscoreStyle.over = buttonsSkin.getDrawable("records");
btnscoreStyle.down = buttonsSkin.getDrawable("records"); // кнопка нажата
scorebutton = new ImageButton(btnscoreStyle);
scorebutton.setSize(300, 200);
stage.addActor(scorebutton);
scorebutton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
game.setScreen(new Score(game) {
});
}
});
//Button EXIT
btnexitStyle = new ImageButton.ImageButtonStyle();
btnexitStyle.up = buttonsSkin.getDrawable("exit");//кнопка не нажата
btnexitStyle.over = buttonsSkin.getDrawable("exit");
btnexitStyle.down = buttonsSkin.getDrawable("exit"); // кнопка нажата
exxitbutton = new ImageButton(btnexitStyle);
exxitbutton.setSize(300, 200);
stage.addActor(exxitbutton);
exxitbutton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Gdx.app.exit();
}
});
// table.add(heading);
table.add(playSkin).width(400).height(100);
table.getCell(playSkin).spaceBottom(30);
table.row();
table.add(scorebutton).width(400).height(100);
table.getCell(scorebutton).spaceBottom(30);
table.row();
table.add(exxitbutton).width(400).height(100);
table.getCell(exxitbutton).spaceBottom(30);
table.row();
table.debug();
stage.addActor(table);
}
启动按钮将正常工作后,在中间,但两侧的边框也创建好,了解原因是什么
最佳答案
问题是在代码的最后你有:
table.debug();
根据 LibGDX Scene2d.ui 文档 (https://github.com/libgdx/libgdx/wiki/Scene2d.ui)
"enables debug lines for tables"
所以,只需删除该行代码就可以了!
关于java - Libgdx:如何删除表格中的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38290250/