public void showMenu() { continua = new TextButton("CONTINUA", Assets.getInstance().getButtonStyle()); continua.setPosition(100, 400); toMenu = new TextButton("MENIU", Assets.getInstance().getButtonStyle()); group = new Group(); group.setSize(100, 100); group.addActor(continua); group.addActor(toMenu); group.setPosition(100, 400); Table table = new Table(); table.add(continua); table.setPosition(100, 400); // stage.addActor(table); // stage.addActor(continua); }
@Override public void create() { stage = new Stage(480, 800, false); group = new Group(); group.setSize(256 * 30, 256); // 横向滚动条 // group.setSize(256, 512*30);//纵向滚动条 images = new Image[30]; int i; for (i = 0; i < 30; ++i) { images[i] = new Image(new Texture(Gdx.files.internal("data/lengjiao.png"))); // images[i] = new Image(new Texture(Gdx.files.internal("data/test1.jpg"))); images[i].setPosition(i * 256, 0); // 横向滚动条 // images[i].setPosition(0, i*512);//纵向滚动条 group.addActor(images[i]); } style = new ScrollPaneStyle(); // 初始化一个ScrollPaneStyle style.background = null; // 把背景设成null,即这个滚动条不需要背景 pane = new ScrollPane(group, style); pane.setSize(480, 256); // 横向滚动条 // pane.setScrollingDisabled(false, true);//设置是否可上下、左右移动..这里设置了横向可移动、纵向不可移动.. // pane.setSize(256,800); stage.addActor(pane); Gdx.input.setInputProcessor(stage); }
@Override public void setSize(float width, float height) { super.setSize(width, height); updateLayouts(); }