<span style="font-size:12px;">配置文件中直接修改</span>
<span style="font-size:12px;">代码里修改</span>
<span style="font-size:12px;">style.xml中修改</span>
<pre name="code" class="html"><span style="font-size:14px;"> 1.AndroidManifest.xml中修改</span>
<span style="font-size:14px;"> 修改activity的theme</span>
<activity
android:name="com.example.newtest.MainActivity"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:label="@string/app_name" >
</activity>
android:theme="Theme.NoTitleBar" 去除标题栏
android:theme="Theme.NoTitleBar.Fullscreen" 去除标题栏加时间栏及下拉框
android:theme="Theme.Light.NoTitleBar" 白色背景并无标题栏
android:theme="Theme.Light.NoTitleBar.Fullscreen" 白色背景,无标题栏,全屏
android:theme="Theme.Translucent.NoTitleBar" 透明背景并无标题
android:theme="Theme.Translucent.NoTitleBar.Fullscreen" 透明背景并无标题,全屏
android:theme="Theme.Wallpaper" 用系统桌面为应用程序背景
android:theme="Theme.Wallpaper.NoTitleBar" 用系统桌面为应用程序背景,且无标题栏
android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" 用系统桌面为应用程序背景,无标题栏,全屏
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// 实现无标题栏(但有系统自带的任务栏):
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
}
在activity的onCreate方法的
setContentView(R.layout.activity_main);前加
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //去除系统的时间栏和下拉框
requestWindowFeature(Window.FEATURE_NO_TITLE); // 去除app的标题栏
3.style.xml中修改
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<!-- 隐藏状态栏 -->
<item name="android:windowFullscreen">true</item>
<!-- 隐藏标题栏 -->
<item name="android:windowNoTitle">true</item>
</style>