Android隐藏状态栏和标题栏,相当于全屏效果

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

[代码] [XML]代码

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" >
10             <intent-filter>
11                 <action android:name="android.intent.action.MAIN" />
12                 <category android:name="android.intent.category.LAUNCHER" />
13             </intent-filter>
14         </activity>
15   
16     </application>
17     <uses-sdk android:minSdkVersion="9" />
18   
19 </manifest>

[代码] [Java]代码

01 @Override
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);
13   
14 }


from : http://www.oschina.net/code/snippet_12_3446
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值