简体   繁体   中英

Libgdx Scene2d Table and Scrollpane bug?

I tried to do a simple scrollable table with buttons. Here is the code:

craft = new Stage();
craftbl = new Table();
craftbl.setDebug(true);
craftbl.add(button1);
craftbl.row();
craftbl.add(button2);
scroll = new ScrollPane(craftbl);
scroll.setSize(640, 480);
craft.addActor(scroll);

But as a result I have only one button on screen: ?

How can i fix it?

Solved. To fix this, you need to set size at least of one of table's cells. EG like this: table.add(somewidget).width(100);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM