【问题标题】:How to hide the navigation bar on the Google Groups mobile site on Android?如何在 Android 上隐藏 Google Groups 移动网站上的导航栏?
【发布时间】:2012-12-06 04:28:52
【问题描述】:

对于我正在制作的应用程序,我们将 Google 群组放在网络视图中,以便我们可以使信息尽可能保持最新。

当我在 WebView 中加载 Google Groups 移动网站时,它会出现一个用于 Google+、Gmail、日历等的导航栏。我想知道是否有办法摆脱这种情况。我知道 Google Groups 有一大堆参数,您可以在 URL 中解析以对其进行自定义,但是我找不到一个可以摆脱此导航栏的参数。

这是加载了 Google Groups 的 WebView 的屏幕截图。我现在用来测试的网址是https://groups.google.com/forum/m/

【问题讨论】:

    标签: android android-webview google-groups


    【解决方案1】:

    事实证明,这个导航栏只有在检测到请求来自 Android 手机时才会出现。所以我们可以简单地将用户代理更改为其他东西,这个导航栏就会消失。

    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true); //Required for Google Groups
    settings.setUserAgentString("MyApplication Android");
    
    webView.loadUrl("https://groups.google.com/forum/m/");
    

    【讨论】:

      猜你喜欢
      • 2019-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多