So, I have an XML file with a RelativeLayout as the root. Can I set this file to a RelativeLayout (not the root) in another file?
Asked
Active
Viewed 52 times
0
-
Kinda sounds like you're looking for the [`include`](https://developer.android.com/training/improving-layouts/reusing-layouts.html) tag. – adneal Sep 06 '17 at 21:01
-
Can this be implemented in Java? – user8199688 Sep 06 '17 at 21:02
-
Why in Java? It's implemented through xml (`include/merge`). But yes, you can `inflate` a layout programmatically. – Phantômaxx Sep 06 '17 at 21:12
-
Please include that in a answer with example. – user8199688 Sep 06 '17 at 21:13
1 Answers
0
Yes, trought:
<include layout="@layout/theFirstRelativeLayout />

Marcos Vasconcelos
- 18,136
- 30
- 106
- 167