inflate(@LayoutRes int resource, @Nullable ViewGroup root, boolean attachToRoot)

来源:互联网 发布:淘宝上零食店铺排名 编辑:程序博客网 时间:2024/05/23 11:47

翻译完英文就懂了
/**
//从一个指定的xml资源中填充一个新的视图层
* Inflate a new view hierarchy from the specified xml resource. Throws
* {@link InflateException} if there is an error.
*
* //参数resource :id用来一个xml布局资源被加载
* @param resource ID for an XML layout resource to load (e.g.,
* R.layout.main_page)
* //参数root : 操作视图去成为父视图在生成的层次结果(如果 attachToRoot 时true)
* @param root Optional view to be the parent of the generated hierarchy (if
* //其他情况,提供一套从root的层次中返回布局的参数值改造一个简单的对象
* attachToRoot is true), or else simply an object that
* provides a set of LayoutParams values for root of the returned
* hierarchy (if attachToRoot is false.)
* 这填充的参数层次是否附属于root参数
* @param attachToRoot Whether the inflated hierarchy should be attached to
* 如果不是,root只用来去创建对应的layoutParams子类从xml的根视图中
* the root parameter? If false, root is only used to create the
* correct subclass of LayoutParams for the root view in the XML.
* 返回根视图在填充的层次中。如果根提供了并且attachToRoot是true;其他情况它就是填充的xml文件的根视图
* @return The root View of the inflated hierarchy. If root was supplied and
* attachToRoot is true, this is root; otherwise it is the root of
* the inflated XML file.
*/

阅读全文
1 0
原创粉丝点击