如何隐藏到code在Android上的标题栏 [英] How to hide the title bar through code in android
本文介绍了如何隐藏到code在Android上的标题栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用$ C $下我的一些活动,以隐藏标题栏。
I want to hide the title bar using code for some of my activities.
我使用了下列code
I have used the following code
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
第二行正在为全屏幕,但它显示了应用程序标题。比方说因为我想隐藏我的标题我的启动画面。的code中的第1行崩溃我的应用程序。请帮我,如果我们可以用code做到这一点。
the second line is working for full screen but it shows the application title. Lets say for my splash screen i want to hide my title. The 1st line of code crashes my application. Please help me if we can do it using code.
感谢。
推荐答案
要隐藏标题栏和状态栏:
To hide title bar and status bar:
try
{((View)act.findViewById(android.R.id.title).getParent()).setVisibility(View.GONE);
}
catch (Exception e) {}
act.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
act.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
view.requestLayout();
要显示的标题栏和状态栏:
To show title bar and status bar:
try
{((View)act.findViewById(android.R.id.title).getParent()).setVisibility(View.VISIBLE);
}
catch (Exception e) {}
act.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
act.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
view.requestLayout();
这篇关于如何隐藏到code在Android上的标题栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文