0

VLayout - space problem?

asked 2011-06-20 09:45:55 +0800

davout gravatar image davout
1435 3 18

I'm trying to align four images in a square layout, so I've used 'vlayout' and 'hlayout' to control this, like..

   private void renderTestCompCell(Component aParent, TestMatrixComponentDO aCompDO) {
      Vlayout aVLayout = new Vlayout();
      aVLayout.setParent(aParent);
      aVLayout.setSpacing("0");
      Hlayout aTopLayout = new Hlayout();
      aTopLayout.setParent(aVLayout);
      aTopLayout.setSpacing("0px");
      Image anImageTL = new Image("/image/data/matrix/small/top_left_blank.png");
      anImageTL.setParent(aTopLayout);
      Image anImageTR = new Image("/image/data/matrix/small/top_right_blank.png");
      anImageTR.setParent(aTopLayout);
      Hlayout aBottomLayout = new Hlayout();
      aBottomLayout.setParent(aVLayout);
      aBottomLayout.setSpacing("0px");
      Image anImageBL = new Image("/image/data/matrix/small/bottom_left_blank.png");
      anImageBL.setParent(aBottomLayout);
      Image anImageBR = new Image("/image/data/matrix/small/bottom_right_blank.png");
      anImageBR.setParent(aBottomLayout);




However, when its's displayed there is a gap between the two rows of images. I've tried setting the vlayout spacing but this seems to have not effect. Is this a bug?

Is there another way of doing this?

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2011-06-20 14:26:49 +0800

babak gravatar image babak
54 1
When I am Sad, I stop bei...

maybe this helps? http://www.zkoss.org/forum/listComment/16626/1/20#reply
adding "px" to the spacing parameter.

link publish delete flag offensive edit

answered 2011-06-20 16:12:40 +0800

davout gravatar image davout
1435 3 18

I've already tried that - no difference.

link publish delete flag offensive edit

answered 2011-06-26 22:42:03 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

updated 2011-06-26 22:42:20 +0800

@davout,

I tried this example code and it works.

<vlayout spacing="0px">
    <div style="width:100px; height:20px;background-color:red"/>
    <div style="width:100px; height:20px;background-color:green"/>
</vlayout>

link publish delete flag offensive edit

answered 2011-06-29 15:28:03 +0800

myzkdemo gravatar image myzkdemo
154 3

Hi davout,

I could reproduce your issue in IE. In FF there isn't a gap between the rows.

I changed the vlayout and hlayout in vbox and hbox. This solves the problem in IE8 but not in IE7. In IE7 there is still a thin gap:

<zk>
<vbox spacing="0px">
<hbox spacing="0px">
    <image src="/img/test.jpg"/>
    <image src="/img/test.jpg"/>
</hbox>  
<hbox spacing="0px">
   <image src="/img/test.jpg"/>
   <image src="/img/test.jpg"/>
</hbox>   
</vbox>
</zk>


regards,
Gunter

link publish delete flag offensive edit

answered 2011-06-29 20:10:40 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

@davout,

I tried my testing case on zksandbox with IE6, IE7, IE9, FF5, Chrome12, all goes well.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-06-20 09:45:55 +0800

Seen: 272 times

Last updated: Jun 29 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More