调整Horizo​​ntalPanel单元的大小 [英] Sizing a HorizontalPanel cell

查看:64
本文介绍了调整Horizo​​ntalPanel单元的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新手提示:

我一直在寻找一种方法来调整Horizo​​ntalPanel的特定单元格。

我想要做的是实现一个2单元的水平面板,并将左侧单元格设置为200px。然而,我试图让正确的单元格填充窗口的其余部分,而不是它的单元格内容。



我看不到树木,请帮忙.. 。

解决方案

  Horizo​​ntalPanel horizo​​ntalPanel = new Horizo​​ntalPanel(); 
horizo​​ntalPanel.setWidth(100%);
Widget widget1 = new Widget();
Widget widget2 = new Widget();
horizo​​ntalPanel.add(widget1);
horizo​​ntalPanel.add(widget2);
horizo​​ntalPanel.setCellWidth(widget1,200);

在上面的代码中,如果widget2的宽度设置为100%,那么widget2将填充窗口的其余部分。如果widget2的宽度不是100%,它不会填充窗口的其余部分。只需检查第二个单元格内容的宽度。它不应该是100%。


Newbie Alert:

I have been furiously looking for a way to size a particular cell of a HorizontalPanel.

What I am trying to do is implement a 2-cell Horizontal Panel and set the left cell to say 200px. However, I am trying to make the right cell fill the rest of the window, not its cells contents.

I cannot see the wood for the trees, please help...

解决方案

         HorizontalPanel horizontalPanel=new HorizontalPanel();
         horizontalPanel.setWidth("100%");
         Widget widget1=new Widget();
         Widget widget2=new Widget();
         horizontalPanel.add(widget1);
         horizontalPanel.add(widget2);
         horizontalPanel.setCellWidth(widget1,"200");

In above code if the widget2's width is set to 100% then widget2 will fill rest of the window.If the widget2's width is not 100% it will not fill rest of the window.Just check the width of your second cell content.It should not be 100%.

这篇关于调整Horizo​​ntalPanel单元的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆