Horizontally centering fields in a vertical field manager

后端 未结 3 961
挽巷
挽巷 2020-12-10 17:48
vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL);
    vfm.add(new LabelField(\"horizontally centered...\",Field.FIELD_HCENTER | LabelField.FOCUSABLE));
    vf         


        
3条回答
  •  佛祖请我去吃肉
    2020-12-10 18:42

    First add your Field to a HorizontalFieldManager (say hfm), then add that hfm to the vfm, I hope this will solve your problem:

    VerticalFieldManager vfm = new VerticalFieldManager();
    HorizontalFieldManager hfm = new HorizontalFieldManager(Manager.FIELD_HCENTER);
    hfm.add(new LabelField("My Label"));
    add(hfm);
    

    See the following link to find An effective way of aligning fields in a VerticalFieldManager

提交回复
热议问题