android 学习五 设置应用程序全屏(没有状态栏和标题栏)
2011-11-12 00:25
363 查看
去除android应用程序的标题栏和状态栏有两种方法:
一种是在java文件中使用如下代码可以实现全屏
二种是在AndroidManifest.xml 中进行配置如下:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:name=".MySchoolAssistantActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
当然可以更加直接的将 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
注意:一个app应用应该统一风格,如果一个界面采用的全屏的方式实现,则其他界面也需要采用全屏的方式实现。所以对于这项需求来说更加适合在xml文件中进行配置
一种是在java文件中使用如下代码可以实现全屏
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //hide the status bar this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); //hide the title bar this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); }如上注释表明哪一部分隐藏工具栏,哪一部分隐藏标题栏
二种是在AndroidManifest.xml 中进行配置如下:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:name=".MySchoolAssistantActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
当然可以更加直接的将 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
注意:一个app应用应该统一风格,如果一个界面采用的全屏的方式实现,则其他界面也需要采用全屏的方式实现。所以对于这项需求来说更加适合在xml文件中进行配置
相关文章推荐
- android 应用程序全屏(没有状态栏和标题栏)
- android 状态栏、标题栏、屏幕高度 设置全屏的方法
- android中去掉标题栏和状态栏,实现全屏
- android-设置状态栏与标题栏背景
- Android中全屏 取消标题栏,TabHost中设置NoTitleBar的三种方法
- Android中全屏(取消标题栏,设置NoTitleBar)的三种方法
- Android界面去掉标题栏,设置为全屏显示
- android去除标题栏和状态栏(全屏)
- 如何设置隐藏Android应用的标题栏和状态栏
- android 设置全屏,状态栏隐藏(全屏)
- Android全屏(包含3种隐藏顶部状态栏及标题栏和一种隐藏Android 4.0平板底部状态栏的方法)
- Android 设置Activity全屏显示,没有TitleBar;自定义TitleBar
- Android(java)学习笔记242:多媒体之设置全屏的方法
- 【Android进阶学习】实现没有标题栏的窗口和全屏显示
- 设置Android应用全屏显示(隐藏手机状态栏)
- Android全屏显示,去除标题栏和状态栏
- android中去掉标题栏和状态栏,实现全屏
- Android&nbsp;设置全屏及自定义标题栏
- Android点滴(9) -- Android 不显示标题栏和全屏的设置方法
- Android 不显示标题栏和全屏的设置方法(转载)