高度为100%的GWT ScrollPanel [英] GWT ScrollPanel with 100% height

查看:75
本文介绍了高度为100%的GWT ScrollPanel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用另一个VerticalPanel内的ScrollPanel内的VerticalPanel构建一个UI.我需要ScrollPanel拉伸到其父对象的高度和宽度,因此我将高度和宽度设置为100%.问题是,如果子级VerticalPanel超出父级的大小,则ScrollPanel会拉伸以适合子级,超出其父级的限制.

I am trying build a UI with a VerticalPanel inside a ScrollPanel inside another VerticalPanel. I need the ScrollPanel to stretch to its parents height and width, so I set the height and width to 100%. The problem is, if the child VerticalPanel exceeds the size of the parent's, the ScrollPanel stretches to fit the child, beyond the limits of its parent.

有没有CSS属性可以限制ScrollPanel的大小?我无法使用maxHeight/maxWidth,因为我不知道父级的尺寸,并希望继续使用"100%"作为宽度/高度值.

Are there any CSS properties to limit the size of the ScrollPanel? I can't use maxHeight/maxWidth because I don't know the dimensions of the parent and would like to continue using "100%" as the width/height values.

谢谢!

推荐答案

很遗憾,您不能将ScrollPanel大小设置为百分比.如果要将scrollPanel的高度设置为客户端的视图高度,则必须在代码中将其高度设置为Window.getClientHeight().

unfortunately, you can't set ScrollPanel sizes to percentage. If you want to set your scrollPanel height to client's view height, you have to manage its height on your code to Window.getClientHeight().

这篇关于高度为100%的GWT ScrollPanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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