请参阅下面的代码。我应用了您在问题中指定的代码,并且我的通知栏被隐藏了。您将无法禁用外部浏览器应用程序的通知栏
public class ContentBrowser extends Activity {
private LinearLayout _progressBarLayout;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.browserlayout);
Bundle receiveBundle = this.getIntent().getExtras();
initialize(receiveBundle.getString("url"));
}
@SuppressLint("SetJavaScriptEnabled")
private void initialize(String url) {
WebView webView = (WebView) findViewById(R.id.browserView);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
webView.getSettings().setDomStorageEnabled(true);
_progressBarLayout = (LinearLayout) findViewById(R.id.browserProgressLayout);
final Activity activity = this;
webView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
// Activities and WebViews measure progress with different scales.
// The progress meter will automatically disappear when we reach 100%
activity.setProgress(progress * 1000);
}
});
webView.setWebViewClient(new browserClient());
if (url != null && !"".equals(url))
webView.loadUrl(url);
}
@Override
public void onBackPressed() {
finish();
}
public class browserClient extends WebViewClient
{
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// TODO Auto-generated method stub
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
_progressBarLayout.setVisibility(View.GONE);
}
}
}