在Android的问题加载的SWF文件加载、文件、问题、Android

2023-09-12 00:56:12 作者:-    无言以对

我有一个问题,当我加载Android模拟器互动的SWF文件。我用2.3.1 AVD。

I have a problem when I load interactive SWF file in android emulator. I use 2.3.1 AVD.

这是在code:

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> 

现在的问题是,当我运行该项目,它会给一个方框中间像右侧的三维尺寸:

Now the problem is that when I run the project, it will give one box at center right side 3D dimension like:

我也试图改变不同的,不同的SWF文件,但不能得到妥善的解决办法。

I have also tried to change different-different SWF file but can't get proper solution.

谁能帮助我?谢谢你。

推荐答案

替换

wv.loadDataWithBaseURL("null", html, mimeType, encoding,  ""); 

wv.loadData(html, mimeType, encoding,  "");
wv.getSettings().setJavaScriptEnabled(true);