1
是否可以在应用程序运行时更改NiftyGui中面板的大小?我想这样的代码: //init
NiftyGui - 如何更改面板的大小
mainScreen = new ScreenBuilder("main") {{
controller(sc);
layer(new LayerBuilder("foreground"){{
childLayoutCenter();
panel(new PanelBuilder("p1"){{
childLayoutAbsoluteInside();
backgroundColor("#00ff00");
width("100%");
height("100%");
padding("10px");
panel(new PanelBuilder("p4"){{
x("100%");y("100%");
height("20%");
width("20%");
backgroundColor("#0000ff");
}});
}});
}});
}}.build(nifty);
//update()
Element f = nifty.getCurrentScreen().findElementById("p4");
f.getParent().layoutElements();
f.setHeight(f.getHeight() + 300);
并没有什么正在发生变化。
你试过了吗? – d3dave 2015-04-04 21:19:44
当然,我失败了。 – gusili 2015-04-05 04:20:23