import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class FullScreenExp extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//全屏設置:
//1.設置隱去狀態欄部分,包括電池等圖標,
//2.無疑就是把我們應用的名字也隱去不顯示,這樣一來就全屏了
//注意: 隱去標題(應用的名字) 此設定必須要寫在setContentView之前,否則會有異常!
//隱去電池等圖標和一切修飾部分(狀態欄部分)
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// 隱去標題欄(程序的名字)
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
}
}
另外:
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".SimpleGraph"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>