How to put two buttons in Horizontal field manager in blackberry for any device?

给你一囗甜甜゛ 提交于 2019-12-08 05:48:43

问题


I have two buttons in a horizontal field manager. one i want to put in left side of the screen and another in right side. How can i put them properly without implementing sub layout, so that it can work for all the device?


回答1:


i think creating your custom manager is best way to layout controls. but i think we can that

VerticalFieldManager vfm = new VerticalFieldManager(USE_ALL_WIDTH);
        vfm.add(new ButtonField("button2",Field.FIELD_RIGHT));

        HorizontalFieldManager hfm = new HorizontalFieldManager();
        hfm.add(new ButtonField("button1"));
        hfm.add(vfm);
        add(hfm);

Edit:

if we are using HFM, it is the responsibility of HFM to align in horizontal.

So

 HorizontalFieldManager hfm = new HorizontalFieldManager(FIELD_RIGHT);
        hfm.add(new ButtonField("button1"));

above code will place button1 to right. but

HorizontalFieldManager hfm = new HorizontalFieldManager();
        hfm.add(new ButtonField("button1",FIELD_RIGHT));

above code will not align button right. So when you are using HFM you need to give horizontal align of field in manager and vertical alignment in field.

When you are using VFM you need to give vertical alignment in manager and horizontal alignment in field.



来源:https://stackoverflow.com/questions/7845438/how-to-put-two-buttons-in-horizontal-field-manager-in-blackberry-for-any-device

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!