繁体   English   中英

在移动表格中的小部件(拥有滚动窗格)之后,Libgdx Scrollpane不会滚动

[英]Libgdx Scrollpane doesnt scroll enough after widgets in the table (that owns a scroll pane) was moved

我有个问题。 在移动表格中的小部件(拥有滚动窗格)之后,Libgdx Scrollpane不会滚动。

这是我的代码中的示例。

Table scrollPaneTable = new Table();
Scrollpane itemsScrollPane = new ScrollPane(scrollPaneTable);
...
mainTable.add(itemsScrollPane).width(WIDTH).height(HEIGHT);
...
//adding items in the scrollPaneTable
// everything is work perfect at this moment.
....
for (final Actor actor : scrollPaneTable.getChildren()) {
...
actor.moveBy(MAIN_QUEST_ITEM_WIDTH * chapterData.quests.size * direction, 0);
...
}
...
//after I move actor in the table, scrollpane scrolls like before, I can't reach the last items.

谢谢你的帮助。

如果有人有这个问题,我想说,我已经解决了很久以前:DI了解滚动条代码是如何工作的,然后理解我需要更改maxX值,但它是私有的。 所以,我将Scrollpane类的完整代码复制到我的项目中,创建了MyScrollPane.java。

然后我将其添加到方法中,以便从类外部更改maxX和maxY。

    public void maxXBy(float x){
        this.maxX += x;
    }

    public void maxYBy(float y){
        this.maxY += y;
    }

然后,在我的主代码中,我使用这些值并获得了预期的结果。

谢谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM