开发者

Cannot add image to my UI

Here is a screenshot of the solution explorer:

Cannot add image to my UI

And here is the code I'm using. Note that the RichTextFields do show up, but no picture. I've tried displaying both of the pictures in the res folder but no dice.

Cannot add image to my UI

final class HelloWorldScreen extends MainScreen {
 BitmapField logo开发者_Python百科Field;

 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;
 }

}


Try removing "res" from the path in the code, i.e:

Bitmap logoImage = Bitmap.getBitmapResource("tip.png");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜