table layout questions

Anything libgdx related goes here!

table layout questions

Postby TruePlayer » Sat Sep 14, 2019 1:43 pm

I add three buttons to the table row. This works, they are automatically aligned in the middle:
Code: Select all
table.add(button3).width(stage.getViewport().getWorldWidth()/4).
                           height(stage.getViewport().getWorldHeight()/16).pad(4);
        table.add(button4).width(stage.getViewport().getWorldWidth()/4).
                           height(stage.getViewport().getWorldHeight()/16).pad(4);
        table.add(button5).width(stage.getViewport().getWorldWidth()/4).
                           height(stage.getViewport().getWorldHeight()/16).pad(4);

Image

then I add a new row using the table.row () method; and try to add a button to this line and make it in the middle. This ruins all the markup, why is this happening?
Code: Select all
table.add(button3).width(stage.getViewport().getWorldWidth()/4).
                           height(stage.getViewport().getWorldHeight()/16).pad(4);
        table.add(button4).width(stage.getViewport().getWorldWidth()/4).
                           height(stage.getViewport().getWorldHeight()/16).pad(4);
        table.add(button5).width(stage.getViewport().getWorldWidth()/4).
                           height(stage.getViewport().getWorldHeight()/16).pad(4);

        table.row();

        table.add(exitButton).
                expandX().
                center().
                width(stage.getViewport().getWorldWidth() * 0.6f).
                height(stage.getViewport().getWorldHeight() * 0.1f);

Image
TruePlayer
 
Posts: 103
Joined: Sun Jul 28, 2019 12:22 pm

Re: table layout questions

Postby tomski » Sat Sep 14, 2019 2:41 pm

tomski
 
Posts: 909
Joined: Wed Jun 26, 2013 6:06 pm

Re: table layout questions

Postby TruePlayer » Sat Sep 14, 2019 3:59 pm

TNX A LOT BRO!
TruePlayer
 
Posts: 103
Joined: Sun Jul 28, 2019 12:22 pm

Re: table layout questions

Postby starkvanna » Mon Sep 16, 2019 11:24 am

@tomski thank u! I have same problem!
Update shell shockers new version
starkvanna
 
Posts: 1
Joined: Mon Sep 16, 2019 11:12 am


Return to Libgdx

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron