【问题标题】:Problems with loading flash files into WebView将 Flash 文件加载到 WebView 的问题
【发布时间】:2011-11-30 15:40:10
【问题描述】:

我正在尝试将一个简单的 swf 加载到嵌入的 WebView 中。

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    WebView wv = (WebView)findViewById(R.id.web);
    WebSettings settings = wv.getSettings();
    settings.setPluginState(PluginState.ON);
    wv.loadUrl("file:///android_asset/example.swf");

}

main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

   <WebView android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:id="@+id/web"/>

</LinearLayout>

我看不出这段代码有什么问题……但我的网页视图仍然显示为黑色

通过检查 LogChat 我发现了这个错误:

11-30 12:46:32.170: E/libEGL(13839): call to OpenGL ES API with no current context (logged once per thread)

是吗?我该如何解决?

我正在使用这个瑞士法郎:http://www.tizag.com/pics/example.swf

我正在使用 Motorola Xoom - Android 3.1。

谁能帮我解决这个问题?

【问题讨论】:

  • 设备是否安装了flash?
  • 是的,问题是,如果我从设备浏览器加载tizag.com/pics/example.swf,它工作正常,但从我的 webView 却没有......

标签: android flash webview


【解决方案1】:

我只是找到自己的答案!!!!您应该在清单中的应用程序中激活属性 android:hardwareAccelerated,如下所示:

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" 
    android:hardwareAccelerated="true" >

【讨论】:

    猜你喜欢
    • 2011-07-19
    • 1970-01-01
    • 1970-01-01
    • 2011-08-10
    • 2010-12-06
    • 2011-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多