package android.app;import android.content.Context; import android.os.Binder; import android.os.RemoteException; import android.os.IBinder; import android.os.ServiceManager; import android.util.Slog; import android.view.View;import com.android.internal.statusbar.IStatusBarService;/** * Allows an app to control the status bar. * * @hide */ public class StatusBarManager {这是类的源码,看上去是@hide 隐藏的。所以直接写就ok了,如果eclipse报错,就需要使用命令生成apk
/** * Allows an app to control the status bar. * * @hide */打了Hide注解,就是不允许外面直接调用。可以在源码环境下编译或者用反射,或者把编译好的classes.jar包放到eclipse的buildpath。
可以用反射,以下代码测试OK try { Object service = getSystemService("statusbar"); if (service != null) { Method expand = service.getClass().getMethod("expandNotificationsPanel");
import android.os.Binder;
import android.os.RemoteException;
import android.os.IBinder;
import android.os.ServiceManager;
import android.util.Slog;
import android.view.View;import com.android.internal.statusbar.IStatusBarService;/**
* Allows an app to control the status bar.
*
* @hide
*/
public class StatusBarManager {这是类的源码,看上去是@hide 隐藏的。所以直接写就ok了,如果eclipse报错,就需要使用命令生成apk
* Allows an app to control the status bar.
*
* @hide
*/打了Hide注解,就是不允许外面直接调用。可以在源码环境下编译或者用反射,或者把编译好的classes.jar包放到eclipse的buildpath。
Object service = getSystemService("statusbar");
if (service != null) {
Method expand = service.getClass().getMethod("expandNotificationsPanel");
expand.invoke(service);
}
} catch (Exception e) {
e.printStackTrace();
}