Oh, my bad. I just noticed one difference. I copy/pasted the contents of the RelativeLayout but not the RelativeLayout itself :) Apparently
android:layout_height="wrap_content" isn't a good choice in this case. The RelativeLayout's height must be a fixed height like: android:layout_height="?android:attr/listPreferredItemHeight" or android:layout_height="100dip" 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." Spencer On Feb 27, 2:18 am, Romain Guy <romain...@google.com> wrote: > 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> wrote: > > > On Thu, Feb 26, 2009 at 7:31 AM, Spencer Riddering > > <ponderyon...@gmail.com> wrote: > > >> 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 > romain...@android.com > > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---