LayoutInflater.from(this).inflate(R.layout.main,tabHost.getTabContentView(),true);
谁能告我下这么一长串东西是什么,,每个.前的函数代表什么,有什么功能。

解决方案 »

  1.   

    将Layout文件转换为View,顾名思义,专门供Layout使用的Inflater。虽然Layout也是View的子类,但在android中如果想将xml中的Layout转换为View放入.java代码中操作,只能通过Inflater,而不能通过findViewById().
      

  2.   

    public View inflate (int resource, ViewGroup root, boolean attachToRoot)
    Since: API Level 1
    Inflate a new view hierarchy from the specified xml resource. Throws InflateException if there is an error.
    参数
    resource     ID for an XML layout resource to load (e.g., R.layout.main_page)
    root     Optional view to be the parent of the generated hierarchy (if 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.)
    attachToRoot     Whether the inflated hierarchy should be attached to the root parameter? If false, root is only used to create the correct subclass of LayoutParams for the root view in the XML.
    返回
        * 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. 
    注意:如果root被提供而且attachToRoot为TRUE的话,在把新生成的View连接到root,返回root.否者返回的是新生成的View。
    如果root被提供但attachToRoot为FALSE的话,root只是把它的LayoutParams参数给新生成的View用,
    不会把新生成的View连接到root。当然返回的是新生成的View。