Getting the actual screen height (android)

前端 未结 4 1009
北海茫月
北海茫月 2021-01-17 10:36

I want to get the actual screen height of the device that runs my app. To achieve this i try the following:

DisplayMetrics metrics = new DisplayMetrics();
get         


        
4条回答
  •  心在旅途
    2021-01-17 10:56

    You can try this:

     WindowManager wm = getWindowManager();
     Display d = wm.getDefaultDisplay();
     Point size = new Point();
     d.getSize(size);
     Log.i("LOG", "W=" + size.x + " , H=" + size.y);
    

提交回复
热议问题