看別人的項(xiàng)目時(shí),發(fā)現(xiàn)竟然用這樣一種方式構(gòu)建
LayoutInflater layoutInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE
查了下資料,才發(fā)現(xiàn)原來我們?nèi)粘K玫?/p>
public View inflate (int resource, ViewGroup root, boolean attachToRoot)
的源碼就是調(diào)用這個(gè)方法,原來大牛都是源碼控哦!
至于這三個(gè)參數(shù)的正確使用姿勢,root如果不為空,就能獲取到layout_開頭的屬性了。