我尝试了以下代码,它在模拟器中可以正常工作,但是在设备上不显示图像时,它只是显示按钮。所以,我能知道是什么原因吗?还是我做错了什么?
public class PhotoExample extends com.codename1.ui.Form {
Container commandBar = null;
public PhotoAnnotatorScreen(String title) {
setTitle(title);
// give this form a border layout
setLayout(new BorderLayout());
getTitleArea().setPreferredH(0);
drawableArea = new AnnotatingArea(graffitiModel);
addComponent(BorderLayout.CENTER, drawableArea);
buildCommandBar();
getStyle().setBgColor(0x323232);
}
protected void buildCommandBar() {
Container c = new Container();
c.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
c.getStyle().setPadding(Component.TOP, 40);
Button palletteCommand = new Button();
Image im = Image.createImage("/sun.png");
palletteCommand.setIcon(im);
c.addComponent(palletteCommand);
Button cancelCommand = new Button();
Image im = Image.createImage("/Cancel-64-ltgrey.png");
cancelCommand.setIcon(im);
c.addComponent(cancelCommand);
Button okCommand = new Button();
Image im = Image.createImage("/Checked-64-ltgrey.png");
okCommand.setIcon(im);
c.addComponent(okCommand);
addComponent(BorderLayout.EAST, c);
commandBar = c;
}
}
在这种情况下,drawableArea只是捕获的图像或任何需要放置在容器中的图像。
请帮助我。谢谢。