Is there a way in android to refer a xml layout file from another layout file. To explain better,
I have a layout file named layout1.xml & layout2.xml. Is it possible for me to refer layout2.xml from layout1.xml
Prefix each attribute name with the node/tag name of the child element, followed by a '/@' and then the name of the child element's attribute. Create a column for the text/cdata value of the child element. The name of the column will be the node/tag name of the child element.
By the term of Nested we mean one Layout inside of other Layout. In Android all layout can be nested one another. In this example we create a Registration Form with multiple fields using Nested Linear Layouts.
XML Nested elements means the element within the element. The structure starts with root element within that another element that follows accordingly. Root element is the most outer element. Inside the root element, all the other elements mentioned can have the inner elements.
Specifically, Android considers XML-based layouts to be resources, and as such, layout files are stored in the reslayout directory inside your Android project. Each XML file contains a tree of elements specifying a layout of widgets and containers that make up one View.
use this:
<include
android:id="@+id/layoutid"
layout="@layout/header" />
refer this doc:
http://android-developers.blogspot.com/2009/03/android-layout-tricks-3-optimize-by.html
edit: fixed broken link
Yes: you can use include or merge.
edit: broken links fixed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With