ViewGroup mMainContainer = (ViewGroup) LayoutInflater.from(this)
.inflate(R.layout.layout, root, attachToRoot);
Log.e("Test", "LayoutParams -> " + mMainContainer.getLayoutParams());
Log.e("Test", "Parent -> " + mMainContainer.getParent());
Log.e("Test", "inflateView -> " + mMainContainer);
root == null 返回根布局 没有布局参数,默认布局参数,占满全屏
root != null 根据传进来的root 得到布局参数 attachToRoot 如果为flase 根布局设置root得到的布局参数,返回根布局; attachToRoot 如果为true 根布局加入到root,根布局布局参数为从root得到的布局参数 返回root , getLayoutParams 得到布局参数是root 父布局的布局参数
//自定义view attachToRoot true root 传入this 本身
inflate(context, R.layout.layout_language_switch, this);
getLayoutParams 为空 父控件为空 返回root;