【问题标题】:Android webview doesn't open twitter page properlyAndroid webview 无法正确打开 twitter 页面
【发布时间】:2016-08-15 15:30:46
【问题描述】:

我有一个 Android 应用程序,可以在 webview 中打开一些页面。你可以看到

screenshot of the page。我看不到推文上可以看到标题。

我已经尝试了所有的 webview 设置,但都不能正常工作。

webview.getSettings().setJavaScriptEnabled(true);
webview.setWebViewClient(new MyWebViewClient());
webview.setWebChromeClient(new MyWebChromeClient);
webview.getSettings().setDefaultTextEncodingName("utf-8");
webview.getSettings().setPluginState(PluginState.ON);
webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setDisplayZoomControls(false);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setDomStorageEnabled(true);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webview.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

[编辑] 我在下面的控制台上收到错误:

I/chromium: [INFO:CONSOLE(0)] "Refused to load the image 'https://www.google.com.tr/ads/ga-audiences?v=1&aip=1&t=sr&_r=4&tid=UA-30775-67&cid=1855674525.1467776671&jid=2048800659&_v=j44&z=267031279&ipr=y' because it violates the following Content Security Policy directive: "img-src 'self' 'unsafe-inline' blob: data: https://*.cdn.twitter.com https://ton.twitter.com https://*.twimg.com https://stats.g.doubleclick.net https://www.google.com https://www.google-analytics.com https://www.periscope.tv".
            ", source: https://mobile.twitter.com/home (0)

【问题讨论】:

  • 发布完整的日志。
  • 是的。我已经检查了prakask。但我检查了日志。没有明显的问题。您可以通过play.google.com/store/apps/details?id=tr.com.socialmedia 地址在我的应用程序中检查问题。这是几周前才开始工作的新功能。但我没有改变它在 webview 4.4 之后不起作用。
  • 我在下面的控制台上收到错误:
  • 有人找到解决方案了吗?我也有同样的问题。在 web 视图中登录 Twitter 后,不会显示推文。向下滚动,然后慢慢向上滚动,有些会显示一秒钟然后消失。如果我注销,则推文显示正常。 html5test.com 显示我的三星 S7 上的 webview 是“Chromium WebView 43”。

标签: android webview chromium


【解决方案1】:

您必须设置 layout_width 和 layout_height 属性,如下所示。

android:layout_width="match_parent"
android:layout_height="match_parent" 

【讨论】:

    猜你喜欢
    • 2011-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多