添加RequestWindowFeature去除标题崩溃
2016-04-15 22:59
447 查看
mark:
解决办法:去掉requestWindowFeature(Window.FEATURE_NO_TITLE);这一句,改为下面两句:
ActionBar actionBar=getSupportActionBar();
actionBar.hide();
也可以简写成一句话代码:
附:Android系统自带样式
在xml文件中进行配置
在项目的清单文件AndroidManifest.xml中,找到需要全屏或设置成无标题栏的Activity,在该Activity进行如下配置即可。
转自:http://www.cnblogs.com/stuart/p/4463305.html
在更换了Android Studio 2.0 作为开发安卓的IDE后,在创建Activity时发现时默认的继承类变成了ActionBarActivity , 当按照传统做法在程序中加上requestWindowFeature(Window.FEATURE_NO_TITLE);想去除标题栏 然而程序却崩溃了,在搜索之后找到了解决方案。做此笔记备忘!
解决办法:去掉requestWindowFeature(Window.FEATURE_NO_TITLE);这一句,改为下面两句:
ActionBar actionBar=getSupportActionBar();
actionBar.hide();
也可以简写成一句话代码:
getSupportActionBar().hide();//隐藏标题栏
附:Android系统自带样式
在xml文件中进行配置
在项目的清单文件AndroidManifest.xml中,找到需要全屏或设置成无标题栏的Activity,在该Activity进行如下配置即可。
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" 平板风格显示
转自:http://www.cnblogs.com/stuart/p/4463305.html
相关文章推荐
- UI控件--RecyclerView(2)
- Android UI基础 --基本控件
- UI性能优化详解
- spark partition discovery
- request.setAttribute()的用法
- ssm架构添加maven、shiro、lucene、ueditor、druid支持
- UI-自定义TabBar
- 从频率到意义:语义向量空间模型(1)(From Frequency to Meaning: Vector Space Models of Semantics)
- Android的线程使用来更新UI----Thread、Handler、Looper、TimerTask等
- POJ-1019 Number Sequence
- 22个值得收藏的android开源代码-UI篇
- print queue
- UINavigationController
- leetcode 63. Unique Paths II
- DocumentBuilder.parse的问题。
- 62. Unique Paths
- 详细解析BluetoothAdapter的详细api
- Android UI组件
- POJ 2785 4 Values whose Sum is 0
- iOS UITableViewCell重用问题