how to get total screen size on an android device programmatically

后端 未结 8 1645
旧巷少年郎
旧巷少年郎 2021-01-02 11:42

if i use the code shown here to get the total screen size it is always short on height to the total screen size as shown in the documented specs for the device. for example

8条回答
  •  萌比男神i
    2021-01-02 11:54

    Get all Display set your width and height as you required.

        Display display;
        display=getWindowManager().getDefaultDisplay();
        text1.setWidth(display.getWidth()-380);
        text1.setHeight(display.getHeight()-720);
    

提交回复
热议问题