如何以编程方式禁用 Android 上的状态栏/通知栏?
我创建一个锁屏应用程序。该应用程序由短信触发。当收到包含命令的短信时,它将显示锁屏活动。
我的锁屏活动正在使用 TYPE_KEYGUARD 禁用主屏幕按钮。当设备屏幕关闭然后我再次打开它时,我的问题是状态栏/通知栏仍然出现在我的屏幕上。这是一个问题,因为即使设备被锁定,用户仍然可以通过状态栏/通知栏访问某些程序。所以我想消失这个状态栏/通知栏,以便用户(盗窃)无法再访问该设备。 请帮我解决这个问题..
i create a lockscreen application.. this application is triggered by SMS.. when a SMS containing command was received, it will display a lock screen activity.
my lockscreen activity is using TYPE_KEYGUARD for disabling a home screen button. When device screen turn off and then i turn it on again, my problem is status bar / notification bar still appear on my screen. this is a problem because the user still can access some program through status bar / notification bar even the device is being locked. so i want to dissapear this status bar / notification bar so that the user (theft) can't access that device anymore..
Please help me to solve this..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为您想要做的是以编程方式将活动设置为全屏。如果是这样,请考虑以下事项:
来源:http://www.androidsnippets。 com/how-to-make-an-activity-fullscreen
I think what you're trying to do is programmatically set an activity as fullscreen. If so, consider the following:
Source: http://www.androidsnippets.com/how-to-make-an-activity-fullscreen
仅禁用活动的标题栏,而不禁用顶部的通知栏。
在 Android 清单中使用此主题进行您的活动:
对我有用。
它隐藏了通知栏。
only disables the activity's title bar, not the notification bar at the top.
Use this theme in android manifest for your activity :
did work for me.
It hides the notification bar.
在 Android 4.0 及更低版本上
选项 1:
选项 2:
在 Android 4.1 及更高版本上
来自 Google 的参考
On Android 4.0 and lower
Option 1:
Option 2:
on Android 4.1 and Higher
Reference from Google