Libgdx 将同一参与者多次添加到表中
我使用这个代码在一个表中水平放置一个演员多次。当我运行代码时,只显示1。我为什么以及如何避开这个问题Libgdx 将同一参与者多次添加到表中,libgdx,Libgdx,我使用这个代码在一个表中水平放置一个演员多次。当我运行代码时,只显示1。我为什么以及如何避开这个问题 private void createUI(){ texture=new Texture("1.png"); ImageButton.ImageButtonStyle fibs=new ImageButton.ImageButtonStyle(); fibs.imageUp=new TextureRegionDrawable(new Texture
private void createUI(){
texture=new Texture("1.png");
ImageButton.ImageButtonStyle fibs=new ImageButton.ImageButtonStyle();
fibs.imageUp=new TextureRegionDrawable(new TextureRegion(texture));
button1= new ImageButton(fibs);
button1.setBounds(0f, 0f, texture.getWidth(), texture.getHeight());
button1.setPosition(0, 0);
scrollTable=new Table();
scrollTable.setBounds(0,0,Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
scrollTable.setPosition(0,50);
scrollTable.add(button1);
scrollTable.add(button1);
scrollTable.add(button1);
stage.addActor(scrollTable);
}
演员包含有关如何和在何处渲染的信息,以及单击该演员时应发生的情况等。因此,不能将同一演员多次添加到舞台。如果您想拥有多个按钮,请创建多个按钮