GWT ScrollPanel没有显示完整的内容 [英] GWT ScrollPanel not showing the complete content

查看:122
本文介绍了GWT ScrollPanel没有显示完整的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用AbsolutPanel作为主面板。我将另一个AbsolutPanel作为标题添加到主面板。
现在我添加一个ScrollPanel到主面板。 ScrollPanel在另一个面板上包含30个按钮。滚动时最后一个按钮没有完整显示。

如果我删除标题AbsolutPanel,则显示所有内容 - 如果我增加标题面板的高度,则显示更少。
包含VerticalPanel的ScrollPanel的可滚动区域随着ScrollPanel外部的标题面板的高度而降低。
如果我为主面板使用Overflow.SCROLL,我可以滚动到verticalPanel的结尾,但在这种情况下,标题面板也会滚动。



每一个帮助非常感谢 - 谢谢!



重现此问题,我做了以下测试:

  AbsolutePanel main = new AbsolutePanel(); 
RootLayoutPanel.get()。add(main);
main.setSize(100px,100%);

AbsolutePanel header = new AbsolutePanel();
main.add(header);
header.add(new Label(HEADER));

VerticalPanel content = new VerticalPanel();
ScrollPanel scroll = new ScrollPanel(content);
scroll.setSize(100px,100%);
main.add(scroll); (int i = 0; i <30; i ++)
content.add(new Button(Button:+ i));



解决方案

由于您使用绝对面板,垂直面板和滚动面板,它们都不是布局面板。因此,您需要将滚动面板的高度设置为某个确定的高度,而不是以百分比形式给出。



更改您的代码

  scroll.setSize(100px,100%); 

  scroll.setSize(100px,500px); 

TADA,它可以工作,并且可以滚动。

I use AbsolutPanel as the main panel. I add another AbsolutPanel as header to the main panel. Now I add a ScrollPanel to the main panel. The ScrollPanel includes 30 buttons on another panel. The last button is not shown completely while scrolling.

If I remove the header AbsolutPanel everything is shown - if I increase the heigh of the header panel less is shown. The scrollable area of the ScrollPanel which includes the VerticalPanel is exactly reduced with the high of the header panel which is outside of the ScrollPanel. If I use "Overflow.SCROLL" for the main panel I can scroll to the end of the verticalPanel but also the header panel is scrolled in this case.

every help is greatly appreciated - thanks!

To reproduce this problem I did the following test:

AbsolutePanel main = new AbsolutePanel();
RootLayoutPanel.get().add(main);
main.setSize("100px", "100%");

AbsolutePanel header = new AbsolutePanel();
main.add(header);
header.add(new Label("HEADER"));

VerticalPanel content = new  VerticalPanel();
ScrollPanel scroll = new ScrollPanel(content);
scroll.setSize("100px", "100%");
main.add(scroll);

for (int i = 0; i < 30; i++)
    content.add(new Button("Button :" + i));

解决方案

Since you are using a combination of Absolute Panel, Vertical Panel and Scroll Panel, None of them are Layout Panels. So you need to see the height of Scroll Panel to some definite height, instead of giving it in percentage.

Change your code

scroll.setSize("100px", "100%");

to

scroll.setSize("100px", "500px");

And TADA, it works and you get a scroll.

这篇关于GWT ScrollPanel没有显示完整的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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