LibGDX物理滚动条ScrollPane

7
我已经创建了一个ScrollPane,但是没有滚动条(就像浏览器侧边的滚动条),你需要用鼠标拖动。如何获得滚动条?
3个回答

5
我所做的添加滚动条的方法是使用libgdx的ScrollPane.ScrollPaneStyle将滚动条设置为九宫格。
ScrollPane.ScrollPaneStyle scrollStyle;
/...

scrollTexture = new Texture(Gdx.files.internal("Scroll9.png"));
scrollNine = new NinePatch(new TextureRegion(scrollTexture,6,6),2,2,2,2);

然后我创建了垂直滚动条。
scrollStyle = new ScrollPane.ScrollPaneStyle();
scrollStyle.vScrollKnob = new NinePatchDrawable(box);

并将样式应用于我的可滚动表格

scroll = new ScrollPane(test, scrollStyle);

source: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/ScrollPane.ScrollPaneStyle.html


4
该条功能是通过皮肤启用的:
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
ScrollPane scrollPane=new ScrollPane(resultsTextArea, skin);

我试过了。现在它可以工作了...


0

结果我自己解决了。 - dan14941
3
请提供正确的答案以便其他用户在未来参考。 - p.streef

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接