Prince Charming
Prince Charming

Reputation: 401

BlackBerry Field Alignment

I am using HorizontalFieldManager with Field.USE_ALL_WIDTH and Field.FIELD_HCENTER but Field.FIELD_HCENTER is not working below is how I am constructing HorizontalFieldManager

HorizontalFieldManager horizontalContainer = new HorizontalFieldManager(Field.USE_ALL_WIDTH | FIELD_HCENTER);

Upvotes: 1

Views: 560

Answers (3)

alishaik786
alishaik786

Reputation: 3726

Try like this in separate class and see the output:

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

Enough;

Upvotes: 0

koti
koti

Reputation: 3701

Declare in the following format

HorizontalFieldManager horizontalContainer = new HorizontalFieldManager(Field.USE_ALL_WIDTH |DrawStyle.HCENTER);

Upvotes: 1

rfsk2010
rfsk2010

Reputation: 8611

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.

Upvotes: 5

Related Questions