Multiline labelfield

自古美人都是妖i 提交于 2020-02-02 07:35:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!