Reputation: 332
I have created a ScrollPane but there is no bar to scroll with (like the one on the side of your browser) you have to drag with your mouse. How can I get a scroll bar?
Upvotes: 7
Views: 4426
Reputation: 3481
The bar is enabled via the skin:
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
ScrollPane scrollPane=new ScrollPane(resultsTextArea, skin);
I tried. It works now...
Upvotes: 4
Reputation: 332
What I did to add a scrollbar was use libgdx's ScrollPane.ScrollPaneStyle to set the scroll bar as a ninepatch.
ScrollPane.ScrollPaneStyle scrollStyle;
/...
scrollTexture = new Texture(Gdx.files.internal("Scroll9.png"));
scrollNine = new NinePatch(new TextureRegion(scrollTexture,6,6),2,2,2,2);
then I created the vertical scroll knob
scrollStyle = new ScrollPane.ScrollPaneStyle();
scrollStyle.vScrollKnob = new NinePatchDrawable(box);
and applied the style to my scrollable table
scroll = new ScrollPane(test, scrollStyle);
Upvotes: 5
Reputation: 3815
This is untested!
It seems that using the following enables scrollbars for a scrollpane.
boolean enable_x = true;
boolean enable_y = true;
scrollpane.setForceScroll(enable_x,enable_y);
Upvotes: 0