Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/385.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在添加ScrollPaneStyle后,Libgdx scrollPane未滚动_Java_Scroll_Libgdx_Scrollpane - Fatal编程技术网

Java 在添加ScrollPaneStyle后,Libgdx scrollPane未滚动

Java 在添加ScrollPaneStyle后,Libgdx scrollPane未滚动,java,scroll,libgdx,scrollpane,Java,Scroll,Libgdx,Scrollpane,当我添加滚动窗格样式时,我的滚动窗格没有滚动,有人知道为什么会发生吗 scroller = new ScrollPane( myWidget , skin); scroller.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); this.addActor(scroller); scroller.setLayoutEnabled( true ); s

当我添加滚动窗格样式时,我的滚动窗格没有滚动,有人知道为什么会发生吗

scroller = new ScrollPane( myWidget , skin);
        scroller.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        this.addActor(scroller);
        scroller.setLayoutEnabled( true );
        scroller.setCancelTouchFocus( true );
        ScrollPaneStyle paneStyle = new ScrollPaneStyle();
        Texture tex = new Texture(Gdx.files.internal(filepath + "page.png"));
        tex.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.ClampToEdge);
        paneStyle.background = new SpriteDrawable( new Sprite(tex));

        scroller.setScrollbarsOnTop(true);
        scroller.setStyle(paneStyle);

初始化scrollpane后,应该首先调用它

mScrollPane.layout();

我遇到了和你一样的问题

当我将滚动面板添加到表中时,它可以在我导出时滚动

ScrollPane pane2 = new ScrollPane(mytable, style);
style.background = new TextureRegionDrawable(scrollAtalas.findRegion("default-rect"));
pane2.setScrollingDisabled(false, true);
pane2.setSize(w, h);
final Table table = new Table();
table.setFillParent(true);
table.add(pane2).fill();

stage.addActor(table);

您也可以从中引用测试代码

您必须添加
stage.act()以在绘制阶段后进行渲染