Android - How to merge two layout XML in Android?
In Android, we can merge two seperate layout XML's into a single XML. It is done using and tags.
tag was created for the purpose of optimizing Android layouts by reducing the number of levels in view trees.
Ex:
Let's create a new Android project and add new Android XML file into "res/layout" folder and name it as "main1".
Now we have two layout main.xml and main1.xml as shown below.
Now we will merge these two layout XML into single layout.
main.xml
Above code you can see that we included a xml file named main1.xml
main1.xml
Build and Run the project. You will see the merged layout like this.
No comments:
Post a Comment