
[ad_1]
I want to change the position of the Buttons inside a table, I tried setting their X and Y, or get their position when adding the Buttons on the Table, but it didn’t work. It always aligns the button on the center.
Code:
TextureAtlas ta = new TextureAtlas("Comecar.txt");
final TextureAtlas.AtlasRegion as = ta.findRegion("comeca");
final TextureAtlas.AtlasRegion as2 = ta.findRegion("comecaversao2");
myTexRegionDrawable2 = new TextureRegionDrawable(as2);
myTexRegionDrawable = new TextureRegionDrawable(as);
myTexRegionDrawable.setMinHeight(300);
myTexRegionDrawable.setMinWidth(260);
myTexRegionDrawable2.setMinHeight(300);
myTexRegionDrawable2.setMinWidth(260);
b = new ImageButton(myTexRegionDrawable);
op = new ImageButton(myTexRegionDrawable2);
op.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
}
});
b.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
gdxGame.setScreen(new Janela2(gdxGame));
}
});
t = new Table();
t.add(b);//I tried setting the position here
t.add(op);
t.setFillParent(true);
stage.addActor(t);
Gdx.input.setInputProcessor(stage);
}
[ad_2]