1
的Image.rotate90Degrees()簡化版,工作並不在iOS上運行,它可以在模擬器和Android。CodenameOne Image.rotate90Degrees()在iOS
圖爲上Nexus5 -Android
[]
行但它在上iPhone6Plus底部變得與WHITE顏色的正方形:
[]
這裏是示例代碼:
public void start()
{
if(current != null){
current.show();
return;
}
Form hi = new Form(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER));
Label label = new Label();
hi.addComponent(BorderLayout.CENTER, label);
Image image = pictures.getImage("000008.jpg");
Image imageNew = Image.createImage(Display.getInstance().getDisplayHeight(), Display.getInstance().getDisplayWidth());
Graphics graphics = imageNew.getGraphics();
graphics.drawImage(image, 0, 0, imageNew.getWidth(), imageNew.getHeight());
imageNew = imageNew.rotate90Degrees(false);
label.setIcon(imageNew);
hi.show();
}
謝謝謝。它在圖像本身旋轉時起作用。 – William