隐藏标题栏需要使用预定义样式:android:theme=”@android:style/Theme.NoTitleBar”. 隐藏状态栏:android:theme=”@android:style/Theme.NoTitleBar.Fullscreen”.
[代码]java代码:
02 | public void onCreate(Bundle savedInstanceState) { |
03 | super .onCreate(savedInstanceState); |
06 | requestWindowFeature(Window.FEATURE_NO_TITLE); |
09 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, |
10 | WindowManager.LayoutParams.FLAG_FULLSCREEN); |
11 | setContentView(R.layout.main); |
12 | text = (EditText) findViewById(R.id.EditText01); |
[代码]xml代码:
01 | < manifest xmlns:android = "http://schemas.android.com/apk/res/android" |
02 | android:versioncode = "1" |
03 | android:versionname = "1.0" |
04 | package = "de.vogella.android.temperature" |
07 | android:icon = "@drawable/icon" |
08 | android:label = "@string/app_name" |
11 | android:label = "@string/app_name" |
12 | android:name = ".Convert" |
13 | android:theme = "@android:style/Theme.NoTitleBar.Fullscreen" |
16 | < action android:name = "android.intent.action.MAIN" /> |
17 | < category android:name = "android.intent.category.LAUNCHER" /> |
21 | < uses-sdk android:minsdkversion = "9" /> |