问题描述
我读了感的答案,并希望确保我明白了什么附加到根呢。
基本上,如果你这样做
I read the answer on Making sense of LayoutInflater and wanted to make sure i understood what attach to root does.Basically if you do
inflater.inflate(int idOfLayoutFile, ViewGroup parent, boolean AttachToRoot)
和让说父母不为空
从我离开了这个问题的答案之一是重视根只影响到返回类型是充气的方法是什么。也就是说,如果 attachToRoot
是真正
,方法将返回父母,如果是假
,由资源ID指定的方法将返回XML文件的根视图。难道我在这里有个好主意还是我失去了一些东西?
From what I got out of that answer was that attach to root just affects what the return type is of the inflate method. That is if attachToRoot
is true
, method will return parent, and if it is false
, the method will return the root view of the XML file as specified by the resource id. Do I have the right idea here or am I missing something?
推荐答案
没有出口,有些东西错过了!
No, something is missed!
当你通过真正
为附加到根',吹气将膨胀指定布局(通过其ID psented重新$ P $),然后将其连接到父根并最后返回父
When you pass true
as 'attach to root', inflater will inflate specified layout (represented by its ID) and then attach it to root of parent and finally return the parent
但是,当你离开附加到根来假
。父层次结构将不会改变,只有充气布局将被退回。
But when you left 'attach to root' to false
. the parent hierarchy won't changed and only inflated layout will be returned.
这篇关于有关布局充气-attach澄清根?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!