在我的Flex移動應用程序中,我的計算機上運行的AIR「adl」模擬器上的一切都很好。但是當我將應用程序部署到我的Android手機或平板電腦時,我遇到了這個奇怪的問題:Adobe AIR/Flex應用程序在縱向啓動時顯示空白屏幕
該應用程序在橫向啓動時工作正常,但是當我以縱向模式啓動它時,它只顯示空白的白色屏幕。如果將其旋轉到橫向模式,它會立即渲染,並且可以將其旋轉回縱向模式,並且仍然可以工作。
我做了一些調試,看起來在縱向打開時,視圖永遠不會被添加到舞臺上,甚至可以達到creationComplete
。但是如果我旋轉成風景,它會立即做到。
任何想法?
Main.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
firstView="views.HomeView">
<fx:Metadata>
[ResourceBundle("resources")]
</fx:Metadata>
<!-- Global CSS styles -->
<fx:Style source="styles/AppStyles.css" />
<fx:Script>
<![CDATA[
// Initialize some vars...
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:ViewNavigatorApplication>
查看/ HomeView.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:components="components.*"
creationComplete="init()" menuKeyPressed="handleMenuKeyPressed(event)"
title="...">
<s:states>
<s:State name="portrait" />
<s:State name="landscape" />
</s:states>
<fx:Script source="ViewHandler.as" />
<fx:Script source="HomeViewHandler.as" />
<fx:Style source="../styles/HomeViewStyles.css" />
.....
<s:Label id="resultsHeading" text="{s('Results')}" fontWeight="bold" addedToStage="setResultsHeadingFont()" />
<s:HGroup width="100%" layoutDirection="{s('layoutDirection')}">
<s:Group id="mainResultsGroup" width="90%">
<s:layout.portrait>
<s:VerticalLayout />
</s:layout.portrait>
<s:layout.landscape>
<s:HorizontalLayout gap="{getScaledNumber(100)}" />
</s:layout.landscape>
<s:VGroup>
.....
這裏init()
不會被調用,直到應用程序爲橫向。
- 更新: 這裏是我的application.xml:
<?xml version="1.0" encoding="utf-8"?>
<application xmlns="http://ns.adobe.com/air/application/4.0">
<id>com.myapp</id>
<versionNumber>0.1</versionNumber>
<supportedProfiles>mobileDevice</supportedProfiles>
<filename>MyApp</filename>
<name>
<text xml:lang="en">My App</text>
</name>
<android>
<manifestAdditions><![CDATA[<manifest android:installLocation="auto">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch" />
</manifest>]]></manifestAdditions>
</android>
<iPhone>
<InfoAdditions><![CDATA[<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
<key>UIRequiresPersistentWiFi</key>
<string>NO</string>
<key>UIPrerenderedIcon</key>
<true />
<key>UIApplicationExitsOnSuspend</key>
<true />
<key>UIDeviceFamily</key>
<array>
<!-- iPhone support -->
<string>1</string>
<!-- iPad support -->
<!--<string>2</string>-->
</array>]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
</iPhone>
<initialWindow>
<title>My App</title>
<content>MyApp.swf</content>
<visible>true</visible>
<fullScreen>false</fullScreen>
<autoOrients>true</autoOrients>
<!--<aspectRatio>landscape</aspectRatio>-->
<renderMode>cpu</renderMode>
<systemChrome>standard</systemChrome>
</initialWindow>
<icon>
<image48x48>icons/icon_48.png</image48x48>
<image57x57>icons/icon_57.png</image57x57>
<image72x72>icons/icon_72.png</image72x72>
<image96x96>icons/icon_96.png</image96x96>
<image114x114>icons/icon_114.png</image114x114>
<image144x144>icons/icon_144.png</image144x144>
<!--<image512x512>icons/icon_512.png</image512x512>-->
</icon>
<description>
<text xml:lang="en">
</text>
</description>
</application>
順便說一句,我使用的FlashDevelop。
你可以發佈你的'[Main] -app.xml'文件嗎?我認爲可能沒有適當地設置「」或「」的值。 –
Brian
@Brian I更新並添加它。 – SZH
你在用什麼「景觀」和「肖像」國家? –