我在 Android模拟器中加载交互式SWF文件时遇到问题.我使用2.3.1 AVD. 这是代码: package com.androidpeople.view; import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; public class WebView
这是代码:
package com.androidpeople.view; import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; public class WebViewExample extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /*WebView webView = (WebView) findViewById(R.id.webview); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("http://www.androidpeople.com"); webView.setWebViewClient(new HelloWebViewClient());*/ String html = "<object width=\"550\" height=\"400\"> <param name=\"movie\" value=\"file:///android_asset/FL.swf\"> <embed src=\"file:///android_asset/FL.swf\" width=\"550\" height=\"400\"> </embed> </object>"; String mimeType = "text/html"; String encoding = "utf-8"; WebView wv=(WebView) findViewById(R.id.webview); wv.getSettings().setJavaScriptEnabled(true); wv.getSettings().setPluginsEnabled(true); wv.loadDataWithBaseURL("null", html, mimeType, encoding, ""); wv.setWebViewClient(new HelloWebViewClient()); } } package com.androidpeople.view; import android.webkit.WebView; import android.webkit.WebViewClient; public class HelloWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }
清单文件:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.androidpeople.view" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".WebViewExample" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="5" /> <uses-permission android:name="android.permission.INTERNET"></uses-permission> </manifest>
现在的问题是,当我运行项目时,它将在中心右侧3D维度给出一个框,如:
我也尝试更改不同的SWF文件但无法获得正确的解决方案.
谁能帮我?谢谢.
更换wv.loadDataWithBaseURL("null", html, mimeType, encoding, "");
同
wv.loadData(html, mimeType, encoding, ""); wv.getSettings().setJavaScriptEnabled(true);