Centering Fields
Hi!
So, are you looking to do something like this (A):
.........Field 1.........
.........Field 2.........
.........Field 3.........
Or something like this (B):
..................................
..................................
..................................
..Field 1..Field 2..Field 3..
..................................
..................................
..................................
(A) centers fields horizontally (all fields are aligned with the horizontal center of the screen)
(B) centers fields vertically (all fields are aligned with the vertical center of the screen)
Using just a VerticalFieldManager all by itself will do neither of these - a VFM only lays out each field it contains vertically, one row at a time, left-justified.
To do (A), you need two things: a VFM (to layout each field on its own separate line), and a Style value (Field.FIELD_HCENTER) set on each field through the field's constructor.
To do (B), you may be able to get away with using a HorizontalFieldManager (to layout each field in one row, left to right), and a Style value (Field.FIELD_VCENTER) set on each field through the field's constructor. However, not actually having done this myself, I'm not sure whether that will actually give you (B) - it may vertically center the fields in the first "row", which will be the top of the screen. You may be able to combat this by setting the style value of the HFM to Field.FIELD_VCENTER.
If you're really aggressive and/or curious and/or bored, you can create your own brand of Manager, and do it brute-force.
Experiment! That's what coding is all about, really. And that's why God invented BlackBerry simulators.....
Cheers,
karl
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
|