Getting the actual screen height (android)

前端 未结 4 1062
北海茫月
北海茫月 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条回答
  •  萌比男神i
    2021-01-17 11:06

    int width=Resources.getSystem().getDisplayMetrics().widthPixels;
    int height=Resources.getSystem().getDisplayMetrics().heightPixels;
    

提交回复
热议问题