Reputation: 85
I have a Dialog :
Dialog dialog=new Dialog("",style);
dialog.setSize(400, 500);
dialog.setPosition(Gdx.graphics.getWidth()/2-200, Gdx.graphics.getHeight()/2-300);
I added a two button in it:
dialog.button(stopButton);
dialog.button(goButton);
My problem is that I can not change the position of buttons, not even if the imposed manually the buttons remain in the same position.
how could I do to solve the problem?
Thank you
Upvotes: 3
Views: 1693
Reputation: 11323
The buttons of a libgdx dialog get added to the ButtonTable of the Dialog, you can get this table by calling getButtonTable()
method and then arrange the buttons like you would do it with any other Table
.
The following code would place goButton below the stopButton for example:
dialog.button(stopButton);
dialog.getButtonTable().row();
dialog.button(goButton);
If you want to fine-tune the layout more, you could just add the buttons to the table and use some TableLayout methods, like for example the below code would add some padding:
dialog.getButtonTable().add(stopButton).pad(20);
dialog.getButtonTable().add(goButton).pad(20);
Upvotes: 5