有没有办法删除通知/状态栏,但不能在 onCreate 中删除?
据我所知,一旦 活动是可见的(有内容),但是......也许我错了?
活动可见后有什么办法隐藏它吗?
As far as I know, it is possible to hide the notification/title bar, once the
activity is visible (has content) , But... maybe I'm wrong?
Is there any way to hide it after the activity is visible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以定义活动以使用消除通知/标题栏的主题。例如,您可以将其作为属性添加到 AndroidManifest.xml 中的
标记中:一旦调用
setContentView( )
。 Activity 启动后隐藏标题栏的唯一方法是使用修改后的意图重新启动 Activity。执行如下操作:然后在
onCreate()
中测试 Intent 中是否存在“NoTitle”额外内容,并在调用之前对
requestWindowFeature()
进行适当的调用setContentView()。You can define the activity to use a theme that eliminates the notification/title bar. For instance, you can add this as an attribute to your
<activity ... >
tag in AndroidManifest.xml:The presence of a title cannot be changed once you have called
setContentView()
. The only way to hide the title bar after your activity has started is to restart the activity with a modified intent. Do something like this:Then in
onCreate()
test whether the "NoTitle" extra is present in the intent and make the appropriate call torequestWindowFeature()
before callingsetContentView()
.