views:

72

answers:

2

Is it possible to have another layout in my main layout? Such that i can set my imageview in another layout.

+1  A: 

Sure, take a look at this blogpost.

http://android-developers.blogspot.com/2009/02/android-layout-tricks-2-reusing-layouts.html

broschb
Is there another way, the code is not in an xml but a class file.
User358218
Thanks but it is not the one im looking for..
User358218
+1  A: 

You can create a child layout from your Java code and then use addView() method.
For example:

LinearLayout l = new LinearLayout(this);
l.addView(new LinearLayout(this));
Aleksander O
Possible to add a @layout file instead? Already have been created.
User358218
Sure, you can use LayoutInflater class.
Aleksander O