On 23 Jan., 14:09, Kostya Vasilyev <[email protected]> wrote:
> Seems like your intent is a side-by-side layout for a tablet device.

I was working on a landscape layout and thought I could "anchor" a
fixed size
RelativeLayout and use a stretched/spanning second RelativeLayout. In
fact
it works here now, but the fixed size layout needs a real fixed size
with concrete dp
value.

> I would recommend you use a top-level LinearLayout (orientation=horizontal),
> and give your two relative layouts layout_width="0dp" and layout_weight="1"
> (that's for a start, you can also experiment with
> layout_width="wrap_content" and other weight values).

Well, interesting idea.

Consider this case: I don't have two nested layouts within the parent,
rather three. And I want this line up initially anchored from the
right.
The most right one is anchored to the right top/bottom corner and the
two others are added from right to left, whereas the second one has
its
natural size and the most left one may be stretched to fill the parent
layout.
I believe this can't be achieved with a LinearLayout with orientation
horizontal.

I think the example should work as intended, and think that the
RelativeLayout
layout_width="wrap_content" should just cover the place that is
actually needed
and not the whole parent layout.

>
> You could also change the way you align two buttons side by side: instead of
> anchoring the right one, and setting layout_toLeftOf on the left one, try a
> more natural sequence. Set layout_alignParentLeft on the left one, and
> layout_toRightOf on the right one. This applies to all four left/right
> button pairs you have in the entire layout.


Unfortunately this gives a different effect than intended.
layout_toRightOf stretches the right buttons, as layout_toLeftOf
stretches the left buttons
( if they are nailed to their respective parent layout corners)
I don't think that the RelativeLayout should depend on some sort of
"natural" sequence,
as layouting from right to left is as natural as doing it from left to
right. It's an algorithm,
why should it depend on something "natural".

So I tend to believe its a bug in RelativeLayouts
layout_width="wrap_content" calculation.
I am interested to discuss this, and if nobody comes up with a good
explanation,
why this is that way, I will report this as a bug.

R.

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