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()代码>以在绘制阶段后进行渲染