WebView不在Android上播放swf文件

Rip*_*yom 1 flash android android-webview

我正在开发一个Android 3.0平板电脑的应用程序,它应该在WebView中播放swf文件.首先,我尝试从设备打开swf文件,而不是通过互联网,没有运气.WebView显示,但在WebView中我只能看到一个黑屏(右侧有3-4 px宽的白线).如果我将相同的URL加载到设备浏览器,则Flash文件可以正常播放.我想我在WebView设置上遗漏了一些东西,但经过几个小时的搜索和谷歌搜索后,我仍然不知道是什么.

Java代码:

 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    setContentView(R.layout.presentation);

    presentationWebView = (WebView) findViewById(R.id.presentation_webview);

    presentationWebView.getSettings().setJavaScriptEnabled(true);
    presentationWebView.getSettings().setPluginsEnabled(true);
    presentationWebView.getSettings().setAllowFileAccess(true);
    presentationWebView.loadUrl("http://my_domain/fileName.swf");
Run Code Online (Sandbox Code Playgroud)

}

presentation.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <WebView
        android:id = "@+id/presentation_webview"
        android:layout_width = "fill_parent"
        android:layout_height = "fill_parent"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

谢谢你非常怀疑任何答案.Ripityom

Rip*_*yom 5

我终于明白了!只需要添加属性

android:hardwareAccelerated = "true"
Run Code Online (Sandbox Code Playgroud)

到我的清单文件.