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?
See Question&Answers more detail:osI am using this thick but it returns "0"
View content = getWindow().findViewById(Window.ID_ANDROID_CONTENT);
int viewHeight = content.getHeight();
How to do so?
See Question&Answers more detail:osroot = (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);
}
});