LibGDX ScrollPane linear scrollbar

I created a ScrollPane, but there is no scroll bar (for example, on the side of your browser) that you have to drag and drop. How can I get the scroll bar?

+5
source share
3 answers

What I did to add the scrollbar was to use libgdx ScrollPane.ScrollPaneStyle to set the scrollbar as a nine-pack.

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

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

+4
source

The panel is allowed through the skin:

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

I tried. Now it works ...

+2
source

This is not verified!

Using the following seems to allow scroll bars to scroll.

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

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

0
source

Source: https://habr.com/ru/post/1211094/