How to get screen resolution in Android Honeycomb?

后端 未结 10 1821
情深已故
情深已故 2020-12-24 09:07

I want to get real resolution of screen on Android Honeycomb.

Here\'s my code

Display display = getWindowManager().getDefaultDisplay();
int w = displ         


        
10条回答
  •  一向
    一向 (楼主)
    2020-12-24 09:39

    Perhaps you can add the height of the status bar. Height of statusbar?

       Rect rectgle= new Rect();
       Window window= getWindow();
       window.getDecorView().getWindowVisibleDisplayFrame(rectgle);
       int StatusBarHeight= rectgle.top;
       int contentViewTop= `enter code here`
          window.findViewById(Window.ID_ANDROID_CONTENT).getTop();
       int TitleBarHeight= contentViewTop - StatusBarHeight;
    
       Log.i("*** Jorgesys :: ", "StatusBar Height= " + StatusBarHeight + " , TitleBar Height = " + TitleBarHeight);
    

提交回复
热议问题