简体   繁体   English

带水平SimplePanel的GWT ScrollPanel

[英]GWT ScrollPanel with Horizontal SimplePanel

I'm trying to implement a scrollPanel within a Horizontal Panel. 我正在尝试在水平面板内实现scrollPanel。
I read this post GWT Horizontal panel with horizontal scrolling 我读了这篇文章GWT水平面板与水平滚动

The answer seems great, however I'm wondering if ravi wrapped his simple panel with a scroll Panel or vice versa. 答案似乎很棒,但是我想知道ravi是否用滚动面板包裹了他的简单面板,反之亦然。

Basically I wanted to know how the panels were nested within each other? 基本上,我想知道面板如何相互嵌套?

A scroll panel is nothing special - it's just a DIV element with some CSS set on it. 滚动面板没什么特别的-它只是一个DIV元素,上面设置了一些CSS。 That's what the answer to the other question means, as a SimplePanel is simply a Widget that appears as a DIV. 这就是对另一个问题的答案的含义,因为SimplePanel只是一个显示为DIV的小部件。

So what the other answer did was create a scrolling widget by: 因此,另一个答案是通过以下方式创建滚动小部件:

  • Creating a SimplePanel as the content container 创建一个SimplePanel作为内容容器
  • Set some CSS with the overflow-x attribute to the SimplePanel 将带有overflow-x属性的一些CSS设置为SimplePanel
  • Setting the content will now have a horizontal scroll bar (due to the CSS attribute). 设置内容现在将具有水平滚动条(由于CSS属性)。

If you prefer a more direct way of doing this check out UiBinder . 如果您喜欢更直接的方法,请查看UiBinder Using it you can combine widgets/CSS/HTML elements in a form closer to how the browser renders your UI. 使用它,您可以将窗口小部件/ CSS / HTML元素组合成一种更接近浏览器呈现UI的形式。 So for example you can create a DIV with the required CSS to achive a scrolling container. 因此,例如,您可以使用所需的CSS创建DIV以实现滚动容器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM