java - Android 应用程序启用的插件

标签 java android eclipse eclipse-plugin webview

喂! 我想在 android 应用程序中使用 flash 播放器。 如果我使用“wSettings.setPluginsEnabled(true);”然后 eclipse 写这个:

The method setPluginsEnabled(boolean) from the type WebSettings is deprecated

因此我使用这个:

 wSettings.setPluginState(PluginState.ON);

但是不能使用 Flash 播放器。 我的代码是这样的:

package com.exm.be;
import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebSettings;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@SuppressLint("SetJavaScriptEnabled")
public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        WebView mywebview = (WebView) findViewById(R.id.webView);
        WebSettings wSettings = mywebview.getSettings();
        wSettings.setJavaScriptEnabled(true);
        wSettings.setPluginState(PluginState.ON);
        mywebview.setWebViewClient(new WebViewClient());
         mywebview.loadUrl("http://www.youtube.com/watch?v=940rzFtFNbs");
    }
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);  
        return true;
    }
}

最佳答案

将 android:hardwareAccelerated="true"添加到您的 list 文件中。

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

关于java - Android 应用程序启用的插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14305278/

相关文章:

c - 在 C 中无法正确调试(Eclipse Mars)

java - 自动生成代码 - 添加 getters/setters 用于方法调用,而不是对象创建

java - 相交 2 个二叉树 - 抛出堆栈溢出错误

android - 如何制作自定义 SeekBar 以在栏中显示颜色渐变?

android - 同步 ("Cache_Group")部分被跳过,为什么会这样?

android - 无法在android中的 Activity 之间传递位图

java - eclipse 插件环境中缺少模式

java - 当应用程序水平显示时,按钮对齐消失

java - 如何在具有迭代dfs的图中找到桥梁?

java - 这段 Java 代码发生了什么?