2011-10-03 132 views
2

我得到了一個VLayout,佔用了屏幕寬度的100%。SmartGWT:水平居中HTMLFlow

它包含一些HTMLFlow元素,它們都是居中。有一個Flow與屏幕具有相同的寬度,並且我想將其「拆分」爲2。從

      "Time remaining: 01:01:01" 

       "Time remaining: 
            01:01:01" 

所以,我試圖流動寬度設定爲50%,其中完全控制我HTMLFlow長度,但隨後的對準移動到左側,

"Time remaining: 
01:01:01" 

然後我試圖把它包含在一個HLayout中,所以它保持居中,但寬度被覆蓋,並且不是50%寬度但更少。

        "Time 
            remaining: 
            01:01:01" 

我如何做到這一點?

回答

1

難道你不能只是將<br /> s添加到HTML字符串。 SmartGWT的HTMLFlow本身沒有辦法控制換行。

從HTMLFlow的Javadoc:

Use the HTMLFlow component to display HTML content that should expand to its natural size without scrolling. [..] NOTE: Since the size of an HTMLFlow component is determined by its HTML contents, this component will draw at varying sizes if given content of varying size.

+0

我希望我可以BR,是不是這樣的線正好有4個字,是動態內容。 – javaNoober

+0

你的解釋也很有幫助。由於HTMLFlow大小是由其內容給出的,所以我認爲製作50%寬度的框包含HTMLFlow可能會有所幫助,但問題在於容器卡在左側 – javaNoober