在状态栏上方显示视图? [英] Display view above status bar?
问题描述
我最近看到了一个应用的图片,它能够在状态栏上方显示一个视图,也能够用一个视图覆盖它.
I recently saw an image of an app that was capable of displaying a view above the status bar and was also able to cover it with a view.
我知道您可以从对齐父顶部的视图中获得状态栏正下方的视图.但是你如何获得状态栏顶部的视图?
I know you can get a view right below the status bar from a view with align parent top. But how would you get a view on top of the status bar??
推荐答案
@Sadeshkumar 的答案对于 ICS 及更高版本(也许 GB 也是如此)不正确.
The answer by @Sadeshkumar is incorrect for ICS and above (perhaps GB as well).
使用 TYPE_SYSTEM_ALERT
和 FLAG_LAYOUT_IN_SCREEN
创建的视图被 StatusBar
覆盖.
A view created with TYPE_SYSTEM_ALERT
and FLAG_LAYOUT_IN_SCREEN
is covered by the StatusBar
.
要在 StatusBar
顶部叠加,您需要使用 TYPE_SYSTEM_OVERLAY
而不是 TYPE_SYSTEM_ALERT
.
To get an overlay on top of the StatusBar
, you need to use TYPE_SYSTEM_OVERLAY
instead of TYPE_SYSTEM_ALERT
.
那么问题来了,如何获得点击/触摸?
The problem being then, how to get clicks/touches?
这篇关于在状态栏上方显示视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!