如何將文字包裝到ListField行中?我在左側顯示圖像,在右側顯示文字。一些較長的文本從ListField行中排出,我希望它能夠包裝而不是被切斷。BlackBerry上的ListField行中的文字環繞
0
A
回答
2
我也遇到了同樣的問題,因爲我的要求也與您的要求相同,但在您未使用圖像但仍希望使用自定義標籤字段來傳遞某些參數的情況下,您可以使用我的方式。
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.Keypad;
import net.rim.device.api.ui.component.LabelField;
public class MyCustomSubscriptionLabelField extends LabelField {
private Bitmap image = null;
private String customName = null;
private String key;
private String programName, startTime;
// Edited by vivek on 2010-11-18 to convert Basic Tv as Live tv i.e mapping
public MyCustomSubscriptionLabelField(String key, String customName,
long style) {
super("", FOCUSABLE);
if (customName == null)
this.customName = key;
else
this.customName = customName;
this.key = key;
}
public MyCustomSubscriptionLabelField(String programName, String startTime,
String customName, long style) {
super("", FOCUSABLE);
this.programName = programName;
this.startTime = startTime;
}
public void setText(String text, int offset, int length) {
// super.setText(customName, image.getWidth(), customName.length());
super.setText(text);
}
public void paint(Graphics graphics) {
super.paint(graphics);
}
public String getCustomName() {
return customName;
}
public String getKey() {
return key;
}
protected boolean navigationClick(int status, int time) {
fieldChangeNotify(0);
return true;
}
protected boolean keyChar(char character, int status, int time) {
if (character == Keypad.KEY_ENTER) {
fieldChangeNotify(0);
return true;
}
return super.keyChar(character, status, time);
}
public void setProgramName(String programName) {
this.programName = programName;
}
public String getProgramName() {
return programName;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getStartTime() {
return startTime;
}
}
使用此自定義標籤字段類使用setText設置任何長文本;
customSubscriptionLabelField[j]=
new CustomSubscriptionLabelField("","Value tht u want to pass and retrive",style);
customSubscriptionLabelField[j].setText("Any Long text will be wrapped to new line ",0,text.length());
希望這將幫助ü在一些地方
0
嘿,我發現多了一個解決我們的問題。 添加圖片到hfm1 添加labelField屬性hfm2 現在添加hfm1和hfm2到VFM 現在這個VFM添加到屏幕上,這將像用圖片和文字,並最有可能的標籤字段的服務於我們的目的
0
我發現答案對黑莓開發者支持論壇這個問題了,並認爲這可能是對你有用: http://supportforums.blackberry.com/t5/Java-Development/Can-drawText-wrap-text-into-multiple-lines/m-p/258817#M42493
相關問題
- 1. 關於Blackberry中的ListField
- 2. BlackBerry listfield development
- 3. BlackBerry瀏覽器:怪異文字環繞行爲
- 4. D3中的文字環繞
- 5. 如何檢查blackberry listfield中的onchildclick?
- 6. 在BlackBerry的ListField中顯示EditField
- 7. Blackberry 6:ListField - 限制顯示行數?
- 8. 環繞文字
- 9. 文字環繞
- 10. 文字環繞
- 11. 圍繞文字環繞HTML
- 12. BlackBerry動態更新ListField
- 13. BlackBerry - 如何將clickEvent(setChangeListener)添加到BlackBerry中的ListField?
- 14. Blackberry - 如何在帶有複選框的ListField中進行文本換行?
- 15. 如何爲Blackberry中的ListField設置字段更改偵聽器?
- 16. Blackberry-如何在每行上方製作ListField標題
- 17. EaselJS文字環繞
- 18. 在BlackBerry ListField中繪製邊框
- 19. 如何在BlackBerry中自定義ListField?
- 20. 在LaTeX中環繞圖形的文字
- 21. Angularjs中的按鈕文字環繞
- 22. 在DIV上和周圍環繞文字
- 23. D3加上環繞文字圈
- 24. 圖中環繞的字
- 25. iPhone:圍繞圖像環繞文字
- 26. 圍繞圖片環繞文字IE
- 27. 圍繞圖像環繞文字
- 28. Flex 4 - 圍繞圖像環繞文字
- 29. 圍繞着浮動環繞文字
- 30. 圍繞圖像環繞文字
謝謝維韋克烏拉圭回合help.I正在實施it.will讓你知道 – arunabha 2011-01-07 17:44:47
喜不將其標記爲回答如果它可以幫助你,讓我知道如果你實現你的照片與文字自定義labelfield – 2011-01-08 06:52:50