Pergunta

For an application I am making we are putting a Google Group in a web view, so that we can keep the information as up to date as possible.

When I load the Google Groups mobile site in the WebView it is coming up with a navigation bar for Google+, Gmail, Calendar, etc. I would like to know if there is a way of getting rid of this. I know Google Groups has a whole heap of parameters you can parse in the URL to customise it however I can't find one to get rid of this navigation bar.

Here is a screenshot of the WebView with Google Groups loaded up. The url I am using to test at the moment is https://groups.google.com/forum/m/

Google Groups loaded on an Android phone

Foi útil?

Solução

It turns out this navigation bar only appears if it detects that the request is coming from an Android phone. So we can simply change the user agent to something else and this navigation bar will disappear.

WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true); //Required for Google Groups
settings.setUserAgentString("MyApplication Android");

webView.loadUrl("https://groups.google.com/forum/m/");
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top