简体   繁体   English

Android 5 Webview中的Intel App Framework 2.2不允许在任何链接上“单击”

[英]Intel App Framework 2.2 in Android 5 webview cannot allow 'clicking' on any link

I have an Android app that is basically just a webview that loads a html page written using Intel's App Framework 2.2. 我有一个Android应用,它基本上只是一个Web视图,可加载使用Intel的App Framework 2.2编写的html页面。 It was running fine since last year. 自去年以来运行良好。 However, on my new Samsung Note 4 that is running Android 5, the app loads, shows the first panel but I was unable to navigate to any links on the page. 但是,在运行Android 5的新Samsung Note 4上,该应用加载,显示了第一个面板,但我无法导航到页面上的任何链接。 Any one have similar problem and managed to solve it? 有人遇到类似的问题并设法解决了吗?

Below is the relevant code for my app and the html. 以下是我的应用和html的相关代码。

_wv = (WebView)findViewById(R.id.browser);
WebSettings ws = _wv.getSettings();
ws.setJavaScriptEnabled(true);
ws.setUseWideViewPort(true);

_wv.setWebViewClient(new WebViewClient(){
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        //Log.d("SGC", "shouldOverrideUrlLoading " + url);
        if (Uri.parse(url).getHost().equals(getString(R.string.app_url))) {
            return false;
        }
        // Otherwise, give the default behavior (open in browser)
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        startActivity(intent);
        return true;
    }
});

_wv.setWebChromeClient(new WebChromeClient() {
    public void onProgressChanged(WebView view, int progress)
    {
    myToast.setText("Loading... " + progress + "%");
    myToast.show();
    }
});
_wv.loadUrl("http://" + getString(R.string.app_url) + "/" + getString(R.string.app_url_name) + "/index.html");

Layout: 布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="${packageName}.${activityClass}" >

    <WebView
        android:id="@+id/browser"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

</LinearLayout>

index.html: index.html:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes" />

    <script src="../js/appframework.min.js" type="text/javascript"></script>
    <script src="../js/appframework.ui.min.js" type="text/javascript"></script>

    <link href="../css/af.ui.min.css" rel="stylesheet" type="text/css">
</head>
<body>
  <div id="afui">
    <div id="content">
      <div class="panel" id="page_main" selected="selected" data-header="header_main">
        <a href=“#page_product”>Products</a>
      </div>

      <div class="panel" id="page_product" data-header="header_back" >
        <p>Our products</p>
        <a href="#page_main">BACK</a>
      </div>
    </div>

    <header id="header_main">
        <h1>Company</h1>
    </header>
    <header id="header_back">
        <h1>Our Products</h1>
    </header>
  </div>
</body>
</html>

Apparently it's appframework.ui.js that is giving the problem on Android 5 webview. 显然是appframework.ui.js在Android 5 webview上带来了问题。 I've attempted many remedies on the java app as well as the html but nothing works. 我在Java应用程序以及html上尝试了许多补救措施,但没有任何效果。 Eventually, I have to upgrade the Intel's App Framework to version 3 to make it work again; 最终,我必须将英特尔的应用程序框架升级到版本3才能再次运行。 and it seems to work for the lower Android versions too. 而且似乎也适用于较低的Android版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM