android隐藏标题栏个人心得,欢迎指正
2016-12-01 11:37
363 查看
1.依赖android-support-v7-appcompat
1.1 getSupportActionBar().hide();必须放在setContentView之前,这种只能解决单个activity的问题。 public class MainActivity extends AppCompatActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //去除标题栏 getSupportActionBar().hide(); setContentView(R.layout.activity_main);
1.2 把parent改变一下,另外再加一个item“windowNoTitle”,application节点下的them不用改变, 也可以自定义style,但做法跟这个一样,只不过名字换了。但是这种在6.0系统上,我感觉黑色的字体变浅了 ,不知道咋回事,求大神告知
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar"> </style> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> <item name="windowNoTitle">true</item> </style>
<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme">>
2.不依赖android-support-v7-appcompat
2.1,这种的话网上很多,基本都对
@Overrideprotected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//去除标题栏
this.requestWindowFeature(Window.FEATURE_NO_TITLE);2.2,在style下多加个item,其余不变
<style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> <item name="windowNoTitle">true</item> </style>
2.3,在application节点下的theme主题换下
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
相关文章推荐
- 关于简历的一点心得(纯属个人想法,非专业人士,欢迎批评指正~)
- 此地用于记录一些个人经验心得等等,欢迎指正
- 如何设置隐藏Android应用的标题栏和状态栏
- android隐藏标题栏和状态
- Android中遇到的一切BUG(到目前为止,这是我笔记薄别瞎喷,错误欢迎指正)
- asp.net为什么没有多重继承(个人观点,欢迎指正,谢谢!)
- Android隐藏标题栏跟状态栏
- Android中隐藏状态栏和标题栏的方法
- Android:Layout_weight的深刻理解,个人首发,欢迎转载和顶贴!
- Android隐藏状态栏和标题栏,相当于全屏效果
- Android中隐藏标题栏和状态栏(电源,信号,时间等信息)
- android 测试Activity,Content Provider,Service,测试些什么?(摘取自官网,个人翻译…欢迎校正)
- android 隐藏状态栏和标题栏
- Android屏幕中隐藏标题栏和状态栏
- Android 应用程序窗体显示状态操作(显示隐藏标题栏或自定义窗体大小)
- android 隐藏标题栏
- Android中隐藏标题栏和状态栏
- Android开发技术之──隐藏标题栏和状态栏
- Android隐藏状态栏和标题栏,相当于全屏效果
- Android隐藏标题栏,全屏显示