GWT LayoutPanel size

后端 未结 1 710
甜味超标
甜味超标 2021-01-16 16:53

I was trying some examples with LayoutPanel in GWT. I tried to place a layoutpanel (with size 100%,100%) onto a ScrollPanel that in turn is attached to the rootlayoutPanel.

1条回答
  •  天涯浪人
    2021-01-16 17:17

    Layout panels can be tricky. LayoutPanels are basically absolute panels, which are intended for full page web apps. To make it work all panels from the root panel down (or from the panel where resize is called and has a fixed size) must have RequiresResize. In your case (besides the err in your example where you add lp instead of sp to the rootpanel, but I assume you intended sp to be added), you put a non LayoutPanel between the RootPanel and the LayoutPanel, this breaks the layout flow and thus the LayoutPanel lp can't be automatically resized. The LayoutPanel will get no height/width.

    However, using a ScrollPanel together with LayoutPanels isn't going to work.The whole idea of a LayoutPanel is to derive it's size based on it's parent size, but inside a ScrollPanel the size isn't related, so the size of a LayoutPanel can't be set.

    0 讨论(0)
提交回复
热议问题