当前位置: 动力学知识库 > 问答 > 编程问答 >

Using Crosswalk in an Android Cordova Project with Embedded WebView

问题描述:

I have an existing Android Cordova project which uses an embedded WebView. What this means is that the Activity does not extend CordovaActivity, but instead embeds the SystemWebView and initializes within the onCreate.

The following is currently how this is being done:

Within the layout XML file

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="fill_parent"

android:layout_height="fill_parent" >

.... other layout elements not related to Cordova....

<org.apache.cordova.engine.SystemWebView

android:id="@+id/cdvWebView"

android:layout_width="fill_parent"

android:layout_height="fill_parent" />

</RelativeLayout>

Within the Activity's onCreate:

SystemWebView systemWebView = (SystemWebView) findViewById(R.id.cdvWebView);

CordovaWebView cdvWebView = new CordovaWebViewImpl(new SystemWebViewEngine(systemWebView));

ConfigXmlParser parser = new ConfigXmlParser();

parser.parse(this);

cdvWebView.init(this, parser.getPluginEntries(), parser.getPreferences());

Due to the bug in Lollipop versions 5.0.+ missing the "set" button, I want to implement the Crosswalk plugin into the project.

Unfortunately, all the documentation I'm finding assumes that a typical Cordova install is being used. I haven't been able to get the embedding and initialization of the XWalkWebView working correctly and keep getting a blank white screen.

Has anybody has success with a similar scenario?

网友答案:

I'm not sure, but this might answer your question. It seems to show implementing an XWalkWebView outside of a typical cordova project:

https://github.com/kurli/crosswalk-website/wiki/How-to-use-Crosswalk-Embedded-API-on-Android

分享给朋友:
您可能感兴趣的文章:
随机阅读: