Reputation: 97
I have 2 xml files, and in the first file need to do the import second file, I tried to do it with Xinclude:
first.xml:
<FirstXml name="first" xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="second.xml"/>
</FirstXml>
second.xml
<SecondXml name="second>
...
</SecondXml>
Then I tried to create an instance of a DocumentBuilderFactory and to enable XInclude processing.
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setXIncludeAware(true);
But when I try to enable the XInclude processing throws an UnsupportedOperationException.
The documentation says that this exception throws when implementations for earlier versions of JAXP is used.
How can I fix this problem? Or how I can do such import in android?
Upvotes: 0
Views: 1539
Reputation: 88
just write the below line in your first.xml file
<include layout="@layout/custom_layout" />
Upvotes: 0
Reputation: 207
<include
layout="@layout/app_bar_starting"
android:layout_width="match_parent"
android:layout_height="match_parent"
you can try these to import the second layout.
Upvotes: 1