Oh, my bad. I just noticed one difference. I copy/pasted the contents
of the RelativeLayout but not the RelativeLayout itself :) Apparently
isn't a good choice in this case. The RelativeLayout's height must be
a fixed height like:
I just noticed the documentation for RelativeLayout even warns against
attempting to create a "... circular dependency between the size of
the RelativeLayout and the position of its children."
On Feb 27, 2:18 am, Romain Guy <romain...@google.com
> When you load a list item make sure you use the inflate() method with
> the following parameters:
> inflate(layoutId, parent, false)
> Not passing the parent will cause ListView to choose the layout
> parameters it wants.
> On Thu, Feb 26, 2009 at 9:34 AM, Marco Nelissen <marc...@android.com
> > On Thu, Feb 26, 2009 at 7:31 AM, Spencer Riddering
> > <ponderyon...@gmail.com
> >> Concerning Romain Guy's post titled "Android Layout Tricks #1" in the
> >> Android Developers Blog.
> >> I just tried to put it to use on a list item (as the article suggests
> >> its good for) and it doesn't work for me. Was this code actually
> >> tested in a list item?
> > Are you saying you copy/pasted the xml layout from the blog post
> > verbatim, and it didn't behave as described in the blog post?
> >> I believe I ran into the same problem last September
> >> http://groups.google.com/group/android-developers/browse_frm/thread/7.
> >> but I never found an explanation.
> >> So, I'm asking a second time;
> >> Why can't I center things vertically within a RelativeLayout that
> >> is in a list item?
> > Because you're doing it wrong? ;)
> > Seriously though, there are multiple apps that center things
> > vertically in a RelativeLayout in a list item, so it certainly is
> > possible.
> Romain Guy
> Android framework engineer