问题
I must show a string that can or not be large enough to not fit in one line in all devices, I want labelfield control to automatically show remaining text in a "new line" after the original one, I mean like... auomatic carret return if the string cannot be showed in a single line, all mobile OS I have tried do this, but I cannot make BB OS to work, it just truncates my string whenever it likes and it's very annoying.
Thank you
回答1:
One way to do this is put your HorizontalFieldManager that contains the LabelField inside a VerticalFieldManager.
E.g.
LabelField labelField = new LabelField("This is a very long sentance that I have written to show that the text will wrap around when it gets to the edge of the field.");
VerticalFieldManager vfm = new VerticalFieldManager();
HorizontalFieldManager hfm = new HorizontalFieldManager();
hfm.add(labelField);
vfm.add(hfm);
add(vfm);
来源:https://stackoverflow.com/questions/6433396/multiline-labelfield