java - libgdx 滚动窗格不滚动

java - libgdx scrollpane doesn't scroll

我目前不知道 libGDX(仅 Android)今天发生了什么... 我有漂亮的 table,带有按钮和其他一些东西,我添加了滚动窗格来滚动(显然),然后我在其他 table 中添加了所有内容并将大小值更改为屏幕中心、缩放等。现在 ScrollPane 不工作了...

buttonsTable = new Table();
buttonsTable.center().center();
// adding buttons and buttons and more buttons...
ScrollPane scroller = new ScrollPane(buttonsTable);
scroller.layout();
scrollableTable = new Table();
scrollableTable.center().center();
scrollableTable.add(scroller);
this.stage.addActor(scrollableTable);

// SIZE_WIDTH and SIZE_HEIGHT are the size of my screen
scrollableTable.pack();
scrollableTable.setTransform(true);
scrollableTable.setScale(0.5f,0.5f); // I changed the scale of the table(1/2)
scrollableTable.setPosition(SIZE_WIDTH/2 - scrollableTable.getWidth()/4, SIZE_HEIGHT/2 - scrollableTable.getHeight()/4); 
// It doesn't update its height and width, so I just divide by 2 and by 2 again to go to the center

table 在我的屏幕中央,但现在 ScrollPane 是 'broken'...

OBS:我在 render() 中调用了 stage.act(Gdx.graphics.getDeltaTime()),在 Screen 的构造函数中调用了 Gdx.input.setInputProcessor(stage);

我测试了一个 ScrollPane 滚动 :

public class TestClass extends ApplicationAdapter {

    Stage stage;
    ExtendViewport extendViewport;

    @Override
    public void create() {

        extendViewport =new ExtendViewport(640,400);

        stage=new Stage(extendViewport);
        Skin skin=new Skin(Gdx.files.internal("skin/glassy-ui.json"));

        Table scrollableTable = new Table();
        scrollableTable.setFillParent(true);
        stage.addActor(scrollableTable);

        Table table = new Table();
        table.add(new TextButton("WELCOME",skin)).row();
        table.add(new TextButton("TO",skin)).row();
        table.add(new TextButton("LIBGDX",skin)).row();
        table.add(new TextButton("GAMING",skin)).row();
        table.add(new TextButton("FRAMEWORK",skin)).row();
        table.pack();
        table.setTransform(true);  //clipping enabled

        table.setOrigin(table.getWidth()/2,table.getHeight()/2);
        table.setScale(.5f);

        final ScrollPane scroll = new ScrollPane(table, skin);
        scrollableTable.add(scroll).expand().fill();

        stage.setDebugAll(true);
        Gdx.input.setInputProcessor(stage);
    }

    @Override
    public void render() {

        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        stage.draw();
        stage.act();
    }

    @Override
    public void dispose() {
        stage.dispose();
    }

    @Override
    public void resize(int width, int height) {
        stage.getViewport().update(width,height);
        stage.getCamera().position.set(320,200,0);
        stage.getCamera().update();
   }
}