DockLayoutPanel无法正常工作

Sta*_*lin 3 css java gwt docklayoutpanel

我用下一个方式描述我的面板

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
         xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<g:DockLayoutPanel unit="PX" width="600" >
    <g:north size="85">
    ....
    </g:north>
    <g:center>
    ....

    </g:center>
</g:DockLayoutPanel>
Run Code Online (Sandbox Code Playgroud)

为北部和中间下一个div生成GWT.

 <div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; height: 85px;"
 <div style="position: absolute; overflow: hidden; left: 0px; top: 85px; right: 0px; bottom: 0px;">
Run Code Online (Sandbox Code Playgroud)

它们包含我需要的数据,但第二个div没有显示.哪里错了?

UPD: 仅举例来说

    <g:center>
        <g:FlowPanel height="100%">
            <g:Label height="100%">TEST2</g:Label>
        </g:FlowPanel>
    </g:center>
Run Code Online (Sandbox Code Playgroud)

我明白了

<div style="position: absolute; overflow: hidden; left: 0px; top: 85px; right: 0px; bottom: 0px;">
<div style="position: absolute; overflow: hidden; left: 0px; top: 85px; right: 0px; bottom: 0px;">
    <div style="height: 100%; position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;">
        <div class="gwt-Label" style="height: 100%;">TEST2</div>
    </div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)

ngs*_*nga 9

我想我知道你做错了什么.你需要这个:

RootLayoutPanel().get().add(new MyView());
Run Code Online (Sandbox Code Playgroud)

代替:

RootPanel().get().add(new MyView());
Run Code Online (Sandbox Code Playgroud)

因为如果你使用uibinder,你需要RootLayouPanel!

我希望它会对你有所帮助!

  • @Travis,似乎你需要使用`RootLayoutPanel`来实现`*LayoutPanel`的一些功能.RootPanel适用于_uibinder_但不适用于`LayoutPanel`s. (2认同)