当我在 Android 模拟器中加载交互式 SWF 文件时遇到问题。我使用2.3.1 AVD。
这是代码:
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 文件,但无法得到正确的解决方案。
谁能帮我?谢谢。
Replace
wv.loadDataWithBaseURL("null", html, mimeType, encoding, "");
with
wv.loadData(html, mimeType, encoding, "");
wv.getSettings().setJavaScriptEnabled(true);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)