我想用Cordova构建一个自定义WebView.为此,我想覆盖setWebChromeClient和setWebViewClient方法.但是为此我需要一个SystemWebViewClient,它需要一个SystemWebViewEngine,我现在似乎无法得到它.这是我的主要活动
public class MyActivity extends CordovaActivity implements CordovaInterface {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int threadSize = getResources().getInteger(R.integer.WIPThreadPoolSize);
// Initiate Thread pool
threadPool = new ThreadPoolExecutor(threadSize, threadSize, 10, TimeUnit.SECONDS, this.priorityQueue);
initApplicationInformationManager();
// initialize global variables
GlobalApplicationVariables.initValues(this);
isActivityReady = false;
isActivityReady = false;
setContentView(R.layout.main_layout);
super.init();
}
protected CordovaWebView makeWebView() {
SystemWebView webView = (SystemWebView) findViewById(R.id.customWebView);
SystemWebViewEngine engine = new SystemWebViewEngine(webView);
return new CordovaWebViewImpl(engine);
}
protected void createViews() {
appView.getView().requestFocusFromTouch();
}
}
Run Code Online (Sandbox Code Playgroud)
我的自定义webview:
@SuppressLint("SetJavaScriptEnabled")
public class CustomWebView extends SystemWebView {
private …Run Code Online (Sandbox Code Playgroud)