zan*_*fio 5 air android actionscript-3 ios leaflet
我想使用StageWebView类将Leaflet Map合并到ios和android air移动应用程序中.不幸的是,地图图像的质量是如此的锯齿状,以至于很难弄清楚街道名称.似乎有一些小的扩展正在进行.出于测试目的,我在http://leafletjs.com/examples/quick-start-example.html上使用了Leaflet教程.
在Android浏览器(chrome)中查看时,图像看起来很好.以下是一些显示问题的简单代码:
package {
import flash.display.MovieClip;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.media.StageWebView;
import flash.geom.Rectangle;
import flash.desktop.NativeApplication;
import flash.utils.setTimeout;
public class Main extends MovieClip{
private var _stageWebView:StageWebView
public function Main()
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
setTimeout( init, 100 );
}
private function init():void {
_stageWebView = new StageWebView();
_stageWebView.stage = this.stage;
_stageWebView.viewPort = new Rectangle( 0, 0, stage.stageHeight, stage.stageWidth );
_stageWebView.loadURL( "http://leafletjs.com/examples/quick-start-example.html" );
}
}
Run Code Online (Sandbox Code Playgroud)
}
有任何想法吗?这可能与解决问题有关吗?
谢谢
您遇到的问题是渲染问题,当然,您可以通过启用硬件加速(强制 GPU 渲染)来避免它。
从 Android 3.0(API 级别 11)开始,Android 2D 渲染管道支持硬件加速,这意味着在视图画布上执行的所有绘制操作都使用 GPU。
因此,要强制 GPU 渲染,您可以:
1 -在应用程序的清单文件中启用硬件加速,您应该将android:hardwareAccelerated应用程序元素的属性设置为 true :
<android>
<manifestAdditions>
<![CDATA[
<manifest>
<application android:hardwareAccelerated="true"/>
</manifest>
]]>
</manifestAdditions>
</android>
Run Code Online (Sandbox Code Playgroud)
这是完整清单文件的示例(我的测试 browser-app.xml):
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<application xmlns="http://ns.adobe.com/air/application/19.0">
<id>browser</id>
<versionNumber>1.0.0</versionNumber>
<versionLabel/>
<filename>browser</filename>
<description/>
<name>browser</name>
<copyright/>
<initialWindow>
<content>browser.swf</content>
<systemChrome>standard</systemChrome>
<transparent>false</transparent>
<visible>true</visible>
<fullScreen>false</fullScreen>
<renderMode>auto</renderMode>
<autoOrients>true</autoOrients>
</initialWindow>
<icon/>
<customUpdateUI>false</customUpdateUI>
<allowBrowserInvocation>false</allowBrowserInvocation>
<android>
<manifestAdditions>
<![CDATA[
<manifest>
<uses-permission android:name="android.permission.INTERNET"/>
<application android:hardwareAccelerated="true"/>
</manifest>
]]>
</manifestAdditions>
</android>
</application>
Run Code Online (Sandbox Code Playgroud)
然后你只需发布你的 AIR 应用程序,你将得到如下内容:
当我评论时你可以看到结果<application android:hardwareAccelerated="true"/>:
2 - 您还可以从 Android 设备的开发人员选项强制 GPU 渲染:
<application android:hardwareAccelerated="true"/>即使有评论,你也可以获得相同的结果:
就这样 !
希望能有所帮助。
| 归档时间: |
|
| 查看次数: |
319 次 |
| 最近记录: |