Android实现隐藏状态栏和标题栏

时间:2021-11-18 02:13:58

隐藏标题栏需要使用预定义样式:android:theme=”@android:style/theme.notitlebar”.
隐藏状态栏:android:theme=”@android:style/theme.notitlebar.fullscreen”.

Android实现隐藏状态栏和标题栏

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="de.vogella.android.temperature"
   android:versioncode="1"
   android:versionname="1.0">
  <application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".convert"
         android:label="@string/app_name"
          android:theme="@android:style/theme.notitlebar.fullscreen" >
      <intent-filter>
        <action android:name="android.intent.action.main" />
        <category android:name="android.intent.category.launcher" />
      </intent-filter>
    </activity>
 
  </application>
  <uses-sdk android:minsdkversion="9" />
 
</manifest>
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@override
public void oncreate(bundle savedinstancestate) {
  super.oncreate(savedinstancestate);
  // hide titlebar of application
  // must be before setting the layout
  requestwindowfeature(window.feature_no_title);
  // hide statusbar of android
  // could also be done later
  getwindow().setflags(windowmanager.layoutparams.flag_fullscreen,
      windowmanager.layoutparams.flag_fullscreen);
  setcontentview(r.layout.main);
  text = (edittext) findviewbyid(r.id.edittext01);
 
}

 

以上所述就是本文的全部内容了,希望大家能够喜欢。