问题描述
我正在制作一个家庭应用程序,我认为如果我使用全屏而不显示状态栏会很合适.所以现在我希望能够使用菜单上的按钮打开或展开状态栏,类似于菜单中某些默认主页应用程序的方式.我知道这是可能的,因为默认主页做到了.这是通过意图完成的吗?如果是的话,我可以有它的代码.如果不是很好,那么如果你们向我展示如何,我将不胜感激.谢谢!
I am making a home application and I think that it will be suitable if I use a fullscreen and not show the status bar. So now I want to be able to open or expand the status bar with a button on the menu, similar to the way some default home applications have in the menu. I know its possible since the default home does it. Is this done through an intent? If so can I have the code for it. If not well then I would appreciate it if you guys showed me how. Thanks!
推荐答案
看看这是否有帮助并告诉我...
See if this helps and let me know...
try{
Object service = getSystemService("statusbar");
Class<?> statusbarManager = Class.forName("android.app.StatusBarManager");
Method expand = statusbarManager.getMethod("expand");
expand.invoke(service);
}
catch(Exception ex){
....
}
uses permission : "android.permission.EXPAND_STATUS_BAR";
这篇关于如何通过意图打开或扩展状态栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论