我编写了一个简单的程序,将两个编辑字段添加到字段管理器中:
HorizontalFieldManager hrfm = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL);
EditField editField1 = new EditField();
editField1.setText("User Name:");
EditField editField2 = new EditField();
editField2.setText("Hello");
hrfm.add(editField1);
hrfm.add(editField2);
add(hrfm);
但是当我运行模拟器时,它只显示UserName字段。我找不到其他编辑字段。为什么会出现这个问题。在添加checkbox时,我也遇到了类似的问题,labelField。请帮助我使用这个FieldManager。谢谢
发布于 2011-10-11 15:32:31
检查How to - Implement advanced buttons, fields, and managers。
这里有JustifiedHorizontalFieldManager --它应该能解决你的需求。
发布于 2011-10-11 15:05:04
Hope this will helps you.
EditField editField1 = new EditField();
editField1.setText("User Name:");
EditField editField2 = new EditField();
editField2.setText("Hello");
int Width = editField1.getPrefferedWidth()+editField2.getPrefferedWidth();
int Height = editField1.getPrefferedHeight()+editField2.getPrefferedHeight();
HorizontalFieldManager hrfm = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL)
{
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Width, Height);
super.setExtent(Width, Height)
}
}
hrfm.add(editField1);
hrfm.add(editField2);
add(hrfm);https://stackoverflow.com/questions/7722173
复制相似问题