覆盖屏幕或 VerticalFieldManager 上的子布局
我正在向屏幕添加 VerticalFieldManager。我正在绘制背景图像并在用户向下滚动时删除屏幕底部的空白,我在垂直字段管理器中覆盖子布局,如下所示:
protected void sublayout( int maxWidth, int maxHeight ) {
super.sublayout( maxWidth, maxHeight );
setExtent(maxWidth,Constants.BACKGROUND_IMAGE.getHeight());
}
这不起作用 - 当用户向下滚动时,空白出现在屏幕底部。我认为在屏幕对象上使用相同的代码覆盖子布局将优先于作为屏幕子级的 VerticalFieldManager 。
I am adding a VerticalFieldManager to a screen. I'm painting a background image and to remove whitespace at the bottom of screen when user scrolls down im overriding sublayout in my verticalfieldmanager like so:
protected void sublayout( int maxWidth, int maxHeight ) {
super.sublayout( maxWidth, maxHeight );
setExtent(maxWidth,Constants.BACKGROUND_IMAGE.getHeight());
}
This doesn't work -- white space appears at the bottom of the screen when the user scrolls down. I thought overriding sublayout, using the same code, on the screen object would take precedence over the VerticalFieldManager, which is a child of the screen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有几件事需要检查。如果在主屏幕上调用
super(VERTICAL_SCROLL | USE_ALL_WIDTH)
,那么实际向下滚动的将是屏幕的管理器,而不是您自定义的 VFM。您可以尝试覆盖 VFM 的 Paint() 方法并执行以下操作:这应该使您的背景随着滚动而“移动”。
A couple things to check. If, on your MainScreen, you're calling
super(VERTICAL_SCROLL | USE_ALL_WIDTH)
then your Screen's manager will be the one actually scrolling down, not the VFM you've customized. You may try overriding the paint() method of your VFM and do something as such:Which should make your background "move" with the scroll.