隱藏標題欄須要使用預約義樣式:android:theme=」@android :style/Theme.NoTitleBar」.
隱藏狀態欄:android:theme=」@android :style/Theme.NoTitleBar.Fullscreen」.android
[代碼] [XML]代碼
01 |
<? xml version = "1.0" encoding = "utf-8" ?> |
02 |
< manifest xmlns:android = "http://schemas.android.com/apk/res/android" |
03 |
package = "de.vogella.android.temperature" |
04 |
android:versionCode = "1" |
05 |
android:versionName = "1.0" > |
06 |
< application android:icon = "@drawable/icon" android:label = "@string/app_name" > |
07 |
< activity android:name = ".Convert" |
08 |
android:label = "@string/app_name" |
09 |
android:theme = "@android :style/Theme.NoTitleBar.Fullscreen" > |
11 |
< action android:name = "android.intent.action.MAIN" /> |
12 |
< category android:name = "android.intent.category.LAUNCHER" /> |
17 |
< uses-sdk android:minSdkVersion = "9" /> |
[代碼] [Java]代碼
02 |
public void onCreate(Bundle savedInstanceState) { |
03 |
super .onCreate(savedInstanceState); |
04 |
// hide titlebar of application |
05 |
// must be before setting the layout |
06 |
requestWindowFeature(Window.FEATURE_NO_TITLE); |
07 |
// hide statusbar of Android |
08 |
// could also be done later |
09 |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, |
10 |
WindowManager.LayoutParams.FLAG_FULLSCREEN); |
11 |
setContentView(R.layout.main); |
12 |
text = (EditText) findViewById(R.id.EditText01); |