一、隐藏标题栏

总体来说,Android隐藏标题栏分两种方式:onCreate中使用代码隐藏  和  AndroidMainfest 定义Activity主题隐藏 ;

Activity继承自Activity时

onCreate-->setContentView方法前加入以下代码:

requestWindowFeature(Window.FEATURE_NO_TITLE);  (也可用下方第二种方式)

Activity继承自AppCompatActivity时

第一种方式:onCreate方法中隐藏

import android.support.v7.app.ActionBar;

ActionBar actionBar = getSupportActionBar();

if (actionBar != null) {

    actionBar.hide();

}

第二种方式:AndroidManifest文件中改变Activity的主题(theme) (这种方式,继承自Activity或者AppCompatActivity都可用)

在res--->values--->styles--->中加入以下代码:

附:

Android:theme="@android:style/Theme.Dialog" 将一个Activity显示为能话框模式 
android:theme="@android:style/Theme.NoTitleBar" 不显示应用程序标题栏 
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不显示应用程序标题栏,并全屏 
android:theme="Theme.Light" 背景为白色 
android:theme="Theme.Light.NoTitleBar" 白色背景并无标题栏 
android:theme="Theme.Light.NoTitleBar.Fullscreen" 白色背景,无标题栏,全屏 
android:theme="Theme.Black" 背景黑色 
android:theme="Theme.Black.NoTitleBar" 黑色背景并无标题栏 
android:theme="Theme.Black.NoTitleBar.Fullscreen" 黑色背景,无标题栏,全屏 
android:theme="Theme.Wallpaper" 用系统桌面为应用程序背景 
android:theme="Theme.Wallpaper.NoTitleBar" 用系统桌面为应用程序背景,且无标题栏 
android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" 用系统桌面为应用程序背景,无标题栏,全屏 
android:theme="Translucent" 透明背景
android:theme="Theme.Translucent.NoTitleBar" 透明背景并无标题
android:theme="Theme.Translucent.NoTitleBar.Fullscreen" 透明背景并无标题,全屏
android:theme="Theme.Panel" 面板风格显示
android:theme="Theme.Light.Panel" 平板风格显示

 

 

 

 

 

 

 

 

     

 

更多相关文章

  1. Android(安卓)DataBinding使用详解
  2. 第一行代码(三)
  3. Android(安卓)纯代码加入点击效果
  4. 查看 android 现在有什么分支
  5. 代码论坛如何通过C的方式在android NDK下面查找本机的mac地址
  6. 显示gif动画(帧动画的播放)
  7. Android(安卓)-- 利用ContentProvider 读取和写入短信
  8. android典型代码系列(十二)------删除某个文件夹里面的所有内容(
  9. [unity3d]Unity3D与android交互----构建android插件

随机推荐

  1. android API key 如何获取
  2. React Native文件读写操作(更新)
  3. Android Custom Dialog错误Unable to add
  4. Android中的菜单-OptionMenu
  5. Android实现仿gallery垂直滚动的效果
  6. Fresco属性
  7. Android第一行代码(第二版)
  8. android中点击空白处隐藏软键盘
  9. android 生成二维码图片
  10. Android emulator中的system.img,userdata