What is the use of “attach to root” in layout inflater?

前端 未结 4 865
春和景丽
春和景丽 2020-12-28 15:11

I am a newbie to android, I know this question has already been asked but i couldn\'t get a satisfactory explanation. My doubts are:

  1. What is \"attach to root\"
4条回答
  •  Happy的楠姐
    2020-12-28 16:14

    If you pass a ViewGroup to it, it will add the inflated View to that ViewGroup. That means, the inflated View will be a child of the passed ViewGroup.

    It is irrelevant whether the ViewGroup is made programatically or by an xml file.

提交回复
热议问题