How to include layout inside layout?

前端 未结 6 782
执念已碎
执念已碎 2020-12-12 20:24

How to include layout inside layout in Android?

I am creating common layout. I want to include that layout in another page.

6条回答
  •  一个人的身影
    2020-12-12 20:54

    From Official documents about Re-using Layouts

    Although Android offers a variety of widgets to provide small and re-usable interactive elements, you might also need to re-use larger components that require a special layout. To efficiently re-use complete layouts, you can use the tag to embed another layout inside the current layout.

    Here is my header.xml file which i can reuse using include tag

    
    
    
    
        
    
    
    

    No I use the tag in XML to add another layout from another XML file.

    
    
    
        
    
            
    
    
        
    

提交回复
热议问题