2015-01-14 86 views

回答

4

我做什么添加一个滚动条是使用libgdx的ScrollPane.ScrollPaneStyle设置滚动条的ninepatch。

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); 

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

0

这是未经测试的!

看起来使用以下命令可为滚动窗格启用滚动条。

boolean enable_x = true; 
boolean enable_y = true; 
scrollpane.setForceScroll(enable_x,enable_y); 

来源:

+0

原来我自己修复它。 – dan14941

+2

然后请提供您的问题的正确答案,以供将来参考其他用户。 –

2

的条通过启用皮肤:

Skin skin = new Skin(Gdx.files.internal("data/uiskin.json")); 
ScrollPane scrollPane=new ScrollPane(resultsTextArea, skin); 

我试过了。它现在的作品...