Scene2d VerticalGroup does not let kids to have own size

Anything libgdx related goes here!

Scene2d VerticalGroup does not let kids to have own size

Postby kokoNuts » Wed Oct 21, 2015 6:18 pm

Hi,

I have been spending few hours to understand this, I will put it in the most simple way. All I want is to have a VerticalGroup with one of the children being a scrollPane and the scrollPane has a VerticalGroup that holds bunch of labels . Here is how I did it:
Code: Select all
VerticalGroup listOfLabels =new VerticalGroup();
for (int i = 0; i < 30; i++) {
            listOfLabels.addActor(new Label(i+" aaaa", skin);
        }
ScrollPane scrollPane=new ScrollPane(listOfLabels);
Container container= new Container<>(scrollPane);
c.setHeight(500); // it does not matter what I put here, but I think VerticalGroup should use this value

//---- following does NOT let even the scroll to work ( no scrolling possible in vertical direction ) I can only see up to "20 aaaa"
VerticalGroup mainVG=new VerticalGroup();
mainVG.setFillParent(true);
mainVG.addActor(container);
stage.addActor(mainVG);

//---- following let scroll to work normally I can scroll and see the "24 aaaa"
Table mainTable=new Table();
mainTable.setFillParent(true);
mainTable.add(c);
stage.addActor(mainTable);


So how come the scroll is possible with table and not with vertical group ? and vertical group is advertised as easy replacement for table with one column. However, I can read in the doc that " The preferred height is the sum of the children's preferred heights" but how can I set children height?
kokoNuts
 
Posts: 9
Joined: Fri Jun 13, 2014 9:36 pm

Return to Libgdx

Who is online

Users browsing this forum: MSN [Bot] and 1 guest