문제

I'm trying to create a HorizontalFieldManager in blackberry app, I want fields to be left aligned which is HFM's default layout but then I want to display one BitmapField right aligned, setMargin(0, 0, 0, Display.getWidth() - bitmap.getWidth()) works fine until I add other Fields in the manager, any ideas please

도움이 되었습니까?

해결책

That's a bit hacky, normally the children are the ones who define the alignment inside the parent manager..

You create the hfm using all width available:

    HorizontalFieldManager hfm = new HorizontalFieldManager(Field.USE_ALL_WIDTH);

Then you add the fields (or managers) aligned to left:

    hfm.add(new LabelField("Left", Field.FIELD_LEFT));

And then you add the fields that must be aligned right. I'm using labels here, but every class extending Field (including managers) has a constructor accepting flags as argument:

    hfm.add(new LabelField("Right", DrawStyle.RIGHT | Field.USE_ALL_WIDTH));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top