Android: Disable and enable to pulling the status bar programmatically for API 19


Staff member
I already done do to hide the status bar, but unfortunately I didn't found the way to display it back once its already hide. I did so many workaround but still not success, <a href="">here</a> and <a href="" rel="nofollow noreferrer">here</a>.


 WindowManager manager = ((WindowManager) getApplicationContext()

 WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
 localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
 localLayoutParams.gravity = Gravity.TOP;
 localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|

 // this is to enable the notification to receive touch events
 WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |

 // Draws over status bar

 localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
 localLayoutParams.height = (int) (50 * getResources()
 localLayoutParams.format = PixelFormat.TRANSPARENT;

 customViewGroup view = new customViewGroup(this);
 manager.addView(view, localLayoutParams);

<strong>customViewGroup class</strong>

class customViewGroup extends ViewGroup {

    public customViewGroup(Context context) {

    protected void onLayout(boolean changed, int l, int t, int r, int b) {

    public boolean onInterceptTouchEvent(MotionEvent ev) {
        return true;