如何从一开始就隐藏标题栏
我正在使用以下代码来替换标题栏。
final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
一旦 UI 加载,它就可以正常工作。然而问题是,当我启动应用程序时,丑陋的灰色条会出现 1-2 秒,直到 UI 加载。有没有办法指定根本不显示默认标题栏?
I am using following code to replace title bar.
final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
And it's working fine once UI loaded. Problem is however when I start the app, the ugly gray bar appears for 1-2 seconds until UI loaded. Is there any way to specify not showing the default title bar at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您希望标题栏在应用内的每个
activity
中消失,请添加到您的清单中。虽然不能 100% 确定这会阻止标题栏暂时显示,但它应该可以工作。
If you want the titlebar to be gone in every
activity
within your app, then addto your manifest. Not 100% sure though that this will prevent the titlebar from showing up momentarily, but it should work.
在清单文件中,将此行添加到
application
标记内,它将隐藏所有活动的栏。如果您想对特定活动隐藏它,请将同一行添加到该活动的标记中。
祝你好运 !
In the Manifest file, add this line inside the
application
tagIt will hide the bar from all the activities. If you want to hide it from a specific activity, add the same line to that activity's tag.
Good Luck !
您应该在 AndroidManifest 中添加一行,声明您使用主题(标准 Android 或扩展)
,然后您可以在 res/values/ 文件夹中添加一个 theme.xml,在其中扩展:Theme.NoTitleBar 并将自定义规则添加到他们(例如 windowBackground)
玩得开心
You should add a line to your AndroidManifest which states that you use a theme (standard android or extended)
and then you can have a themes.xml in your res/values/ folder where you extend the: Theme.NoTitleBar and add custom rules to them (for example like windowBackground)
Have fun