我有一個簡單的Android應用程序,目標Android 1.5或以上。我有一個活動被設置爲使用下面的主題(在清單中設置)。全屏活動w/Webview仍然顯示狀態欄頂部
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
在活動中,我有一個web視圖(請參閱完整的XML :)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
我相信我有我的onCreate
代碼設置,妥善處理urlLoading(見下文)。在模擬器中,當我測試這個代碼時,狀態欄不會顯示在頂部。在我的目標設備上運行的是一款運行Android 1.5並且屏幕分辨率爲800 x 480的愛可視7家用平板電腦,該應用程序運行,但狀態欄顯示在頂部。
任何想法,爲什麼這可能會發生?
主要活動的完整來源:
package com.bri.RestaurantLauncher;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class RestaurantLauncherMain extends Activity {
private class RestaurantLauncherMainWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
}
WebView webview;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
this.webview = (WebView) findViewById(R.id.webview);
webview.setWebViewClient(new RestaurantLauncherMainWebViewClient());
this.webview.getSettings().setJavaScriptEnabled(true);
this.webview.loadUrl("http://www.google.com");
}
}
對您的問題的可能答案:http://stackoverflow.com/a/4483904/436938 – 2011-12-01 06:42:38