android - libGDX Scrollpane not scrolling for single Label -


i adding "how play" instructions game have created using libgdx. instructions scroll need shown inside fixed area of screen, not full screen scroll. have created stage , added background , other actors, , labels title(outside scroller) , instructions text(the thing need scrolled). should not scrolling horizontally, vertically. set width of label , wrapped text. in short need full control of position , size of scroller, shouldn't full screen. wrote following code add instruction scroller:

private void addhelpcontent() {     int width = (int) (0.85*alertbounds.width);     int height = scrollstarty - scrollendy;     int x = constants.app_width/2 - width/2;      bitmapfont font = model.getinstance().createfont(constants.rock_normal_font_file_path, 20);     label.labelstyle labelstyle = new label.labelstyle();     labelstyle.font = font;     labelstyle.fontcolor = color.valueof("a07e10ff");     label label = new label(gethelpstring(), labelstyle);     label.setwidth(width);     label.setwrap(true);     label.pack();     label.setfillparent(true);     scrollpane scrollpane = new scrollpane(label);     scrollpane.setbounds(x, scrollendy, width, height); //this should bounds of scroller , scrollable content need inside     scrollpane.layout();     scrollpane.settouchable(touchable.enabled);     addactor(scrollpane); } 

but facing 2 problems:

  1. i not able scroll scrollpane. label cut off right @ bounds making scrollpane useless.
  2. the other actors except labels doesn't appear @ first, appear after scroll scrollpane(and won't scroll). problem not there if comment off code add scroll pane. sure related scrollpane itself.

can please me solve this?

i forgot add act() method in stage class. adding solved issue.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -