如何将两个按钮水平场经理黑莓任何设备? [英] How to put two buttons in Horizontal field manager in blackberry for any device?

查看:116
本文介绍了如何将两个按钮水平场经理黑莓任何设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个水平场经理两个按钮。一个我希望把在屏幕的左侧,另一个位于右侧。我怎样才能把它们正确地贯彻无子布局,以便它可以为所有的设备?

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?

推荐答案

我想创建自定义的经理是布局控件最佳途径。
但我认为,我们可以在

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);

编辑:

如果我们使用HFM,它是HFM的责任在水平对齐。

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

所以

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

以上code将会把Button1以正确的。

above code will place button1 to right. but

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

以上code将不对齐按钮的权利。
所以,当您使用HFM
你需要给在现场经理和垂直对齐场的水平保持一致。

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.

当您使用VFM
你需要给在现场经理和水平对齐垂直对齐方式。

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

这篇关于如何将两个按钮水平场经理黑莓任何设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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