JavaSwing基础之Layout布局相关知识详解

论坛 期权论坛 期权     
niminba   2021-5-26 12:31   8315   0

一、View layout方法

首先,还是从ViewRootImpl说起,界面的绘制会触发performMeasure、performLayout方法,而在performLayout方法中就会调用mView的layout方法开始一层层View的布局工作。

private void performLayout(WindowManager.LayoutParams lp, int desiredWindowWidth,
            int desiredWindowHeight) {
 
        final View host = mView;
        host.layout(0, 0, host.getMeasuredWidth(), host.getMeasuredHeight());
    }

mView我们都知道了,就是顶层View

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:1060120
帖子:212021
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP