TabLayoutPanel not showing widgets only Tab items are visible

让人想犯罪 __ 提交于 2019-12-11 04:31:41

问题


Simple example of TabLayoutPanel not showing container widgets only Tab items are visible. Something going wrong is it works for IE8

public class DemoGWT implements EntryPoint {
    RootPanel rp = RootPanel.get();

    public void onModuleLoad() {
        TabLayoutPanel panel = new TabLayoutPanel(25, Unit.PX);
        Label a = new Label("One Container");
        panel.add(a, "One Hdr");
        panel.add(new Label("Two Container"), "Two Hdr");
        panel.add(new Label("Three Container"), "Three Hdr");
        panel.add(new Label("Four Container"), "Four Hdr");
        panel.add(new Label("Five Container"), "Five Hdr");
        panel.add(new Label("Six Container"), "Six Hdr");

        rp.add(panel);
    }
}

回答1:


Don't mix up Layout panels and panels. When you use layout panels such as TabLayoutPanel, Make sure its parent and their parent upto RootPanel are layout panels. Use RootLayoutPanel instead of RootPanel. TabLayoutPanel will not display data unless you mention its absolute height. (Note 100% or any other % won't work). It has to be absolute.

Change the RootPanel to RootLayoutPanel and use setHeight(height) API of your TabLayoutPanel. Don't mention height in %age.




回答2:


I had problems with ie8 with tab client areas not being displayed.

We had created ui XML template panel. Our setup was to display a TabLayoutPanel within a tab of another TabLayoutPanel. The first TabLayoutPanel was entirely visible, the child TabLayoutPanel was invisible but not 'hidden'.

BTW this problem didn't exhibit itself under Firefox!!!!!

Making all panels children of ResizeComposite and ultimately children of root layout panel made no difference. However I kept that mod as it seemed to be the correct GWT way of coding layout panels.

The problems solution as it turned out was quite surprising and unexpected.

I had specified sizes of composite panels in EM units. When I switched the child TabLayoutPanel to PX units and it's tab children panels to PX units everything displayed OK.



来源:https://stackoverflow.com/questions/13738904/tablayoutpanel-not-showing-widgets-only-tab-items-are-visible

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!