接收隐藏状态栏/于服务进入全屏活动事件 [英] Receiving hidden status bar/entering a full screen activity event on a Service

查看:129
本文介绍了接收隐藏状态栏/于服务进入全屏活动事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个增加了一些意见,窗口管理器(类似Facebook的聊天头)的服务。该意见留在一切之上的时候,甚至当我在相机应用。 是否有可能知道一些活动(如摄像机或视频播放器)是一个使用全屏幕,这样我可以隐藏我的意见?

I have a service that adds some views to the window manager (something like facebook's chat heads). This views stay on top of everything all the time, even when I'm on the camera app. Is it possible to know when some activity (like the camera or a video player) is using full screen so I can hide my views?

编辑:

有一种叫做View.OnSystemUiVisibilityChangeListener但它需要的API 11.我的目标是9,但看起来这正是我需要的。对于API 9任何别的选择吗?

There's something called View.OnSystemUiVisibilityChangeListener but it requires API 11. My target is 9, but it looks like this is exactly what I need. Any alternative for API 9?

推荐答案

好吧,如果有人有兴趣,我已经解决了我的问题是这样的: 增加了一个透明的视图窗口管理器,用1px的宽度和高度match_parent。然后加入一个全球性的布局监听这一观点,并且每次有对布局的变化,我检查这个观点在屏幕上的位置。如果是Y是0,那么状态栏是不可见的,所以一个全屏幕应用程序必须运行。这工作比原生View.OnSystemUiVisibilityChangeListener更好,因为它似乎还有一些应用程序,不知怎的,不触发这个方法(如新的雅虎天气)。

Ok, if anyone is interested, I've solved my problem this way: Added a transparent view to the window manager, with 1px width and match_parent height. Then added a global layout listener to this view, and everytime there's a change on the layout, I check the position of this view on screen. If it's Y is 0, then the status bar is not visible, so a full screen app must be running. This works even better than the native View.OnSystemUiVisibilityChangeListener because it seems there are some apps that somehow don't trigger that method (like the new yahoo weather).

这篇关于接收隐藏状态栏/于服务进入全屏活动事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆