1

我将 Horizo​​ntalFieldManager 与 Field.USE_ALL_WIDTH 和 Field.FIELD_HCENTER 一起使用,但 Field.FIELD_HCENTER 不工作 下面是我构建 Horizo​​ntalFieldManager 的方式

Horizo​​ntalFieldManager Horizo​​ntalContainer = new Horizo​​ntalFieldManager(Field.USE_ALL_WIDTH | FIELD_HCENTER);

4

3 回答 3

5

The Field class provides the following style bits for alignment:

Horizontal alignment styles

  • FIELD_LEFT
  • FIELD_HCENTER
  • FIELD_RIGHT

Vertical alignment styles

  • FIELD_TOP
  • FIELD_VCENTER
  • FIELD_BOTTOM

The horizontal alignment styles are only recognized when a Field is added to a VerticalFieldManager, and the vertical alignment styles only apply when a Field is added to a HorizontalFieldManager. Fields added to a HorizontalFieldManager are ALWAYS aligned to the left.

于 2012-02-06T14:22:19.873 回答
1

按以下格式声明

Horizo​​ntalFieldManager Horizo​​ntalContainer = new Horizo​​ntalFieldManager(Field.USE_ALL_WIDTH |DrawStyle.HCENTER);

于 2012-02-06T14:55:59.270 回答
0

在单独的类中尝试这样并查看输出:

HorizontalFieldManager hr=new HorizontalFieldManager(Field.FIELD_HCENTER);
hr.add(new LabelField("Black",Field.FOCUSABLE));        
hr.add(new LabelField("Berry",Field.FOCUSABLE));
add(hr);

足够的;

于 2012-02-07T03:56:16.077 回答