LayoutInflater中四种类型inflate方法的介绍

转自:http://blog.csdn.net/aa4790139/archive/2011/05/07/6401556.aspx

第一种:
public
View inflate (int resource, ViewGroup root)
reSource:View的layout的ID
root:如果返回null,则将此View作为根,此时就可以应用此View中的其他控件了。
          如果返回!null, 则将默认的layout作为View的根。
第二种:
public
View inflate (XmlPullParser parser, ViewGroup root)
parser:你需要解析xml的解析接口
root:如果返回null,则将此View作为根,此时就可以应用此View中的其他控件了。
          如果返回!null, 则将默认的layout作为View的根。
第三种:
public
View inflate (XmlPullParser parser, ViewGroup root, boolean attachToRoot)
parser:你需要解析View的xml的解析接口
root:如果返回null,则将此View作为根,此时就可以应用此View中的其他控件了。
          如果返回!null, 则将默认的layout作为View的根。
attachToRoot:
        ture:也就将此解析的xml作为View根
        fase:则为默认的xml,作为根视图View
第四种:
public
View inflate (int resource, ViewGroup root, boolean attachToRoot)

resource:View的layout的ID

root:如果返回null,则将此View作为根,此时就可以应用此View中的其他控件了。

          如果返回!null, 则将默认的layout作为View的根。

attachToRoot:

           ture:也就将此解析的xml作为View根
           fase:则为默认的xml,做为根视图View

posted @ 2013-10-02 21:09  KillerLegend  Views(461)  Comments(0Edit  收藏  举报