Copy Code code as follows:
Package com.aslibra.test;
Import android.app.Activity;
Import Android.graphics.Rect;
Import Android.os.Bundle;
Import Android.util.Log;
Import Android.view.Window;
Import Android.widget.ImageView;
public class Test extends activity {
ImageView IV;
@Override
public void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.main);
IV = (ImageView) This.findviewbyid (R.ID.IMAGEVIEW01);
Iv.post (New Runnable ()
{
public void Run ()
{
viewinited ();
}
}
);
log.v ("test", "= = OK = =");
}
private void viewinited () {
Rect rect= new Rect ();
Window window= GetWindow ();
iv.getwindowvisibledisplayframe (rect);
int statusbarheight= rect.top;
int contentviewtop= Window.findviewbyid (window.id_android_content). GetTop ();
int titlebarheight= contentviewtop-statusbarheight;
//test results: After OK, more than 100 MS is running
log.v ("Test", "=-init-= statusbarheight=" + statusbarheight+
"contentviewtop=" +contentviewtop+
"titlebarheight=" +titlebarheight);
}
/*
* 07-14 02:36:48.449:verbose/test (1385): = = OK =
* 07-14 02:36:48.558:verbo Se/test (1385): =-init-= statusbarheight=25 contentviewtop=50 titlebarheight=25
*
}
The browser gets the code for the height of the status bar
Copy Code code as follows:
Rect visrect = new Rect ();
if (!mbrowserframelayout.getglobalvisiblerect (Visrect)) {
if (logd_enabled) {
LOG.D (LogTag, "Showfaketitlebar Visrect failed");
}
Return
}
Params.y = Visrect.top;