I am using this thick but it returns "0"
View content = getWindow().findViewById(Window.ID_ANDROID_CONTENT); int viewHeight = content.getHeight();
How to do so?
root = (ViewGroup)findViewById(R.id.root); root.post(new Runnable() { public void run(){ Rect rect = new Rect(); Window win = getWindow(); win.getDecorView().getWindowVisibleDisplayFrame(rect); int statusHeight = rect.top; int contentViewTop = win.findViewById(Window.ID_ANDROID_CONTENT).getTop(); int titleHeight = contentViewTop - statusHeight; Log.w("dimens_tag", "title = " + titleHeight + " status bar = " + statusHeight); } });
1.4m articles
1.4m replys
5 comments
57.0k users