【发布时间】:2013-08-23 19:24:50
【问题描述】:
我有一个Labelfield、EditField 和一个Button,它们垂直居中对齐。我在 Verticalfield 管理器中添加了这三个字段,然后将其添加到 Horizontal Field Manager 中。最后将 HFM 添加到另一个 VFM。现在在 9800 设备或 9380 曲线中,我观察到当我触摸编辑字段时,虚拟键盘即将到来。它部分隐藏了编辑字段。
当虚拟键盘出现时,我想将这些东西向上移动。我怎样才能做到。我的代码在这里:
HorizontalFieldManager hfm = new HorizontalFieldManager();
VerticalFieldManager vfmComponent = new VerticalFieldManager(USE_ALL_WIDTH);
vfmComponent.add(lfServerUrl);
vfmComponent.add(mEfURL);
vfmComponent.add(mBtnSave);
hfm.add(vfmComponent);
int topEmptySpace = (Display.getHeight() - (Bitmap.getBitmapResource(mStrTopBar).getHeight() + hfm.getPreferredHeight() + 25)) / 2;
hfm.setMargin(topEmptySpace, 0, 0, 0);
VerticalFieldManager vfmMain = new VerticalFieldManager(VERTICAL_SCROLL| NO_HORIZONTAL_SCROLL );
vfmMain.add(hfm);
add(vfmMain);
请帮忙。
【问题讨论】:
-
你能解释一下为什么你有这么多嵌套管理器吗?如果将此代码放在
MainScreen子类中,则屏幕已经内置了VerticalFieldManager。我不明白为什么你不能只使用那个经理,然后摆脱hfm、vfmComponent和vfmMain。但是,可能是我不明白你的设计。也许截图会有所帮助?这很重要,因为您可能已通过复杂的布局触发了此错误,并且解决方法可能需要知道需要滚动哪个垂直字段管理器。 -
我已经通过自定义我的顶级 vfm 来修复它。所以不需要添加那么多经理。不知怎的,你就在这里。
标签: blackberry keyboard blackberry-editfield