以下是解决方案资源管理器的屏幕截图:
这是我正在使用的代码。请注意,RichTextFields确实显示,但没有图片。我试过在res文件夹中显示两张图片,但没有骰子。
final class HelloWorldScreen extends MainScreen {
BitmapField logoField;
public HelloWorldScreen() {
super();
LabelField title = new LabelField("Moxxy Email Sender",
LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
setTitle(title);
add(new RichTextField("1. Where do you want to send this?"));
add(new RichTextField("2. What's your name?"));
add(new RichTextField("3. Write down your message:"));
Bitmap logoImage = Bitmap.getBitmapResource("res/tip.png");
logoField = new BitmapField(logoImage, Field.FIELD_HCENTER);
add(logoField);
}
public boolean onClose() {
Dialog.alert("Goodbye!");
System.exit(0);
return true;
}
}
答案 0 :(得分:0)
尝试从代码中的路径中删除“res”,即:
Bitmap logoImage = Bitmap.getBitmapResource("tip.png");