android 禁用通知栏下拉 完全禁用

2024-12-03 17:23:35
推荐回答(2个)
回答1:

1.在AndroidManifest.xml中添加权限



2.在相应的activity中添加
@Override
public void onWindowFocusChanged(boolean hasFocus) {
// TODO Auto-generated method stub
super.onWindowFocusChanged(hasFocus);
try {

Object service = getSystemService("statusbar");
Class statusbarManager = Class.forName("android.app.StatusBarManager");
Method test = statusbarManager.getMethod("collapse");
test.invoke(service);
} catch (Exception ex) {
ex.printStackTrace();
}
}

参考地址:http://blog.csdn.net/nosxcy/article/details/7196810

回答2:

我就想问下解决了吗?我也是同样的问题