LayoutInflater的inflate方法参数
public View inflate(int resource, ViewGroup root, boolean attachToRoot)
如果调用inflate方法,传入了ViewGroup root参数,则会从root中得到由layout_width和layout_height组成的LayoutParams,在attachToRoot设置为false的话,就会对我们加载的视图View设置该LayoutParams。
如果设置了ViewGroup root参数,且attachToRoot设置为true的话,则将我们加载的视图做为子视图添加到root视图中。
posted on 2017-09-16 10:18 Jesseylove 阅读(210) 评论(0) 收藏 举报
浙公网安备 33010602011771号