That's why I was suggesting RelativeLayout. With it, some items can be
pushed to the bottom, while others positioned in other ways.
Your suggestion for nested LinearLayout would work, too. It's just that
I really like using RelativeLayout (I think it's really nice, once you
get the hang of it). But yes, there are many ways to skin this cat.
A key point, perhaps, is this: the OP wants to do this from code, and
for that, the LayoutParams class that needs to match the the enclosing
layout of the view that's being created.
So when adding views to a LinearLayout, use LinearLayout.LayoutParams.
When adding to a RelativeLayout, use RelativeLayout.LayoutParams, and so on.
-- Kostya
10.09.2010 11:27, Indicator Veritatis пишет:
But won't that make all the widgets in the Layout go to the bottom? So
he will need to have one LinearLayout vertically oriented for the
widgets that go at the top or middle, then start another vertically
oriented LinearLayout (with fill-parent) with android:gravity="bottom"
and buttons only.
Or something like that. Like they say about Perl, "there's more than
one way to do it";)
On Sep 9, 1:49 pm, Mark Murphy<[email protected]> wrote:
2010/9/9 Kostya Vasilyev<[email protected]>:
You are right about LinearLayout being able to lay out its views vertically,
but it does so top to bottom.
The OP seems to want his buttons to be pushed to the bottom of the enclosing
layout, and I think that for that case, a RelativeLayout with
layout_alignParentBottom (specifies from code) is a better, perhaps only
option.
Ah, I missed that part.
Actually, I suspect that android:gravity="bottom" on the LinearLayout
may suffice to have the buttons be at the bottom.
--
Mark Murphy (a Commons
Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
Android Training in London:http://skillsmatter.com/go/os-mobile-server
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
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