Thanks Romain!

That does the trick. Found the doc in Release change note from M5, but
apparently not doc'ed otherwise.

>From what I've read and tried, it seems that the layout properties on
the <merge> container does NOT transfer to the new element after
inflating the subtree, and I must define them in code. Is this
accurate?

-dave

On Dec 22, 12:58 pm, Romain Guy <[email protected]> wrote:
> You can use the <merge /> tag as the root tag of the inflated XML
> file. It basically lets you add all the children of the XML file into
> the supplied root. For instance:
>
> mylayout.xml:
> <merge>
>   <Button />
>   <Button />
> </merge>
>
> class MyLayout extends LinearLayout {
>   // adds the two buttons as children of "this"
>   inflate(R.layout.mylayout, this, true);
>
>
>
> }
> On Mon, Dec 22, 2008 at 6:36 PM, Dave Kong <[email protected]> wrote:
> > Hi all,
>
> > Perhaps this has been posted but I couldn't find the answer through
> > searching. So would appreciate a redirect if that's the case.
>
> > I love to inflate my views when I construct a custom Layout, since I can
> > have the behavior in code but presentation defined in xml files. However, I
> > find that when I do inflate, the inflated tree is added as a child view of
> > my custom Layout object. So I end up with, say, a LinearLayout (my
> > class).LinearLayout (xml). The end effect is that my hiearchy is twice as
> > deep as it needs to be.
>
> > How do I have the inflated subtree completely replace my custom class? That
> > is, have the the subtree's root set as *this*. Is this possible? (ViewStub
> > won't work since I need my custom class to derive from Layout for behavior
> > code).
>
> > -dave
>
> --
> Romain Guy
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to