如何下拉状态栏编程机器人 [英] How to Drop down status bar programmatically android
本文介绍了如何下拉状态栏编程机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:结果
<一href=\"http://stackoverflow.com/questions/5029354/how-can-i-programmatically-open-close-notifications-in-android\">How可以在我的Android编程方式打开/关闭通知?
我需要一个code将在机器人编程下拉状态栏。有什么办法砸下来呢?
I need a code that will drop down the status bar in android programmatically. Is there any way to drop it down ?
推荐答案
在任何地方使用该code。
Use this code anywhere.
Object sbservice = getSystemService( "statusbar" );
Class<?> statusbarManager = Class.forName( "android.app.StatusBarManager" );
Method showsb = statusbarManager.getMethod( "expand" );
showsb.invoke( sbservice );
还是要使它更短的使用这样的:
Or to make it more short use this :
StatusBarManager statusBar = (StatusBarManager) getSystemService(STATUS_BAR_SERVICE);
statusBar.expand();
权限是必需的清单中。
Permission is required in manifest.
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
这篇关于如何下拉状态栏编程机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文