Q:

Get the visible height of a view

Is it possible to know the visible height of my activity as soon as the status bar opens?
I want to know the visible height of my screen.

A:

Try View treeobserver method..
Like :
   main_layout.getViewTreeObserver().addOnGlobalLayoutListener(
            new OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() 
                    {

                        Rect r = new Rect();
                        // r will be populated with the coordinates of your view
                        // that area still visible.
                        main_layout.getWindowVisibleDisplayFrame(r);

                        int heightDiff = main_layout.getRootView().getHeight()-(r.bottom -r.top);

                    }
    });

Replace main_layout with your desired View's object.
Hope it can help.

