开发者

android - add one xml layout in other xml layout

开发者 https://www.devze.com 2023-01-15 23:51 出处:网络
I have two XML layouts declared in 开发者_如何学Cthe res/layout folder one contains the generic template and the other contains the views specific to a particular screen. I want to add the second xml

I have two XML layouts declared in 开发者_如何学Cthe res/layout folder one contains the generic template and the other contains the views specific to a particular screen. I want to add the second xml layout to the first one i.e. the generic one. As both of these layouts are declared as XML, I am not able to add one to other. How do I solve this problem?


I may not be understanding it correctly. But it might be a lot easier to use the <include layout="@layout/yourlayouthere" /> method to simply embed using just XML notation. I use this method to build a bunch of little parts and then pull them together in my main layout using the inlcude statement.


Have you tried using a LayoutInflater and inflating your specific view and adding it to a ViewGroup or FrameLayout?

0

精彩评论

暂无评论...
验证码 换一张
取 消