Well, thanks for thinking about it for me, I appreciate it. But that's
not the problem here.

It's not really the constraint between the siblings (Spinner,
TextView) that's the problem, but rather the content of the Spinner is
not reflected in the Spinner's size computations.

There are issues with doing so. You could do so statically - but it
would require enumerating your entire collection, which could be very
expensive. Or you can do it dynamically and re-layout whenever the
selected view changes. That's not ideal, either; you may not want to
have your view change sizes dynamically. But I don't see a solution
that doesn't involve one of the two -- or doing neither, and having
things not work.

In my testing, I do more than just move the XML elements around; I do
adjust the constraints to not be forward references. (I'd like to keep
it working on 1.5 for now).

But Mark's message points out I didn't try using forward references. I
don't expect that to be different, if my analysis of the situation is
correct, but it's a hole in my analysis.

On Mar 13, 6:21 am, Brion Emde <brione2...@gmail.com> wrote:
> Bob,
>
> Forgive me if this is obvious to you, but I have to remind myself over
> and over. RelativeLayout makes only a single pass through your XML to
> determine the Ids and collect the layout information. So it is
> essential that you order the elements correctly to make sure you have
> no forward references. RelativeLayout does not complain if you do and
> it will appear that the elements are not obeying your layout
> parameters.
>
> Just a thought that came to me this morning...
>
> Brion
>
> On Mar 11, 4:21 pm, Bob Kerns <r...@acm.org> wrote:
>
>
>
> > Are you sure? This sounds like exactly what I was asking earlier
> > today, based on my experience with Spinner. I speculated that ListView
> > might exhibit the same behavior.
>
> > You describe the behavior I was expecting. Instead, the Spinner
> > ignored all constraints. If I put it first in the layout, it would
> > overlay or squeeze out the text. (I forget what distinguished the two
> > behaviors).
>
> > If I put it second, the text would fail to wrap and the Spinner would
> > get squeezed out. I just could not get the Adapter-supplied views to
> > participate in the sizing process.
>
> > I expect that I could have given it a fixed size, but that would be a
> > bug itself.
>
> > I don't have time to try it again with ListViews at the moment, but if
> > anyone can confirm this working, especially with RelativeLayout, I'd
> > appreciate it.
>
> > On Mar 11, 10:35 am,BrionEmde <brione2...@gmail.com> wrote:
>
> > > You can totally do this.
>
> > > Make sure that your TextView is set to
> > > android:layout_height="wrap_content" and not to "fill_parent". That
> > > will surely do what you are describing.
>
> > > ---
>
> > > On Mar 11, 5:35 am, Pipen <erik.ing...@gmail.com> wrote:
>
> > > > Dear All,
>
> > > > I've tried to add a TextView before a ListView in a LinearLayout. The
> > > > result is that the ListView wont show at all. The same thing happens
> > > > if I put the TextView after the ListView, but then I will only see the
> > > > ListView.
>
> > > > Is there a way to get a text view above the ListView without to much
> > > > of a hassle?
>
> > > > Kind regards

-- 
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

Reply via email to