I'm building a menu for my game and I'm stuck.
When I position a Container with it's setPosition
function and add a Button to the container with setFillParent
set to true
the button's position isn't set to the same position as the container.
The button size matches the size of the Container but its position is wrong. When I don't set setFillParent
to true
the position of the button within the container is right but the size is wrong.
Here is the code, pretty simple:
Container container = new Container(exitButton);
exitButton.setFillParent(true/false);
The green hightlight on the image is the container
, the [X] image is the exitButton
.
Ok, I figured it out, calling
container.fill()
before setting the containers size and position somehow solves the problem. No idea why, but it solves it.