android 屏幕划分


获取手机屏幕区域高度 public int getWindowArea() { Display display = getWindowManager().getDefaultDisplay(); Point point = new Point(); display.getSize(point); int width = point.x; int height = point.y; return height; }
应用区域高度
    public int getApplicationArea() {
        Rect rect = new Rect();     
        getWindow().getDecorView().                                               
        getWindowVisibleDisplayFrame(rect);
        int width = rect.width();
        int height = rect.height();
        return height;
    }
 获取view绘制区域高度
    public int getDrawArea() {
        Rect rect = new Rect(); 
        getWindow().findViewById(Window.ID_ANDROID_CONTENT)     
                   .getDrawingRect(rect);
        int width = rect.width();
        int height = rect.height();
        return height;
    }
posted @ 2017-02-26 14:49  x-bing  阅读(782)  评论(0编辑  收藏  举报