在带有嵌入式WebView的Android Cordova项目中使用Crosswalk [英] Using Crosswalk in an Android Cordova Project with Embedded WebView

查看:994
本文介绍了在带有嵌入式WebView的Android Cordova项目中使用Crosswalk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个现有的Android Cordova项目,它使用嵌入式WebView。这意味着Activity不会扩展CordovaActivity,而是嵌入SystemWebView并在onCreate中初始化。

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:

在布局XML文件中

<?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>

在活动的onCreate内:

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());

由于 Lollipop版本5.0中的错误+缺少设置按钮,我想将Crosswalk插件实现到项目中。

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

不幸的是,我发现的所有文档都假设正在使用典型的Cordova安装。我没有能够得到嵌入和初始化的XWalkWebView正常工作,并保持得到一个空白的白色屏幕。

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.

任何人都有成功的类似情况吗? / p>

Has anybody has success with a similar scenario?

推荐答案

我不确定,但这可能回答你的问题。它似乎显示在典型cordova项目之外实现XWalkWebView:

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- Android

这篇关于在带有嵌入式WebView的Android Cordova项目中使用Crosswalk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆