在android中加载swf文件的问题 [英] Problem loading swf file in android

查看:21
本文介绍了在android中加载swf文件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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.

这是代码:

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 维度上给出一个框,例如:

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);  

这篇关于在android中加载swf文件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆