Another option would be to put your title in a LinearLayout with weight 1 so
that it takes up all the vertical space except for the space the button
takes up.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent">

   <LinearLayout android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_weight="1">

      <TextView android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:text="This is a Title" />

   </LinearLayout>

   <Button android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      android:id="@+id/Submit"
      android:text="Button 1" />

</LinearLayout>

On Thu, Oct 2, 2008 at 8:36 AM, Cadge <[EMAIL PROTECTED]>wrote:

>
> Ok I understand now,
>
> Thanks a lot.
>
> On Oct 2, 4:27 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> > layout_gravity=bottom works only in horizontal LinearLayouts. In your
> > case, you should use a RelativeLayout. Then, on your TextView, use
> > android:layout_alignParentTop="true" and on the Button, use
> > android:layout_alignParentBottom="true".
> >
> >
> >
> > On Thu, Oct 2, 2008 at 8:22 AM, Cadge <[EMAIL PROTECTED]>
> wrote:
> >
> > > Ok I tired as you suggested replacing the line
> >
> > > -----------------------------------
> > >  android:gravity="bottom"
> > > -----------------------------------
> >
> > > with
> >
> > > -----------------------------------
> > >  android:layout_gravity="bottom"
> > > -----------------------------------
> >
> > > with the rest of the code staying as it was. But it still hasn't
> > > changed anything and the button still apears at the top.
> >
> > > Any ideas?
> >
> > > Cheers.
> >
> > > On Oct 2, 1:46 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
> > >> Cadge wrote:
> > >> > I have a (extremely) simple app that shows some text and a button
> > >> > which does nothing just now. As it stands the text appears with
> button
> > >> > imediately below this.
> >
> > >> > What I want to do is keep the text at the top but move the button to
> > >> > the bottom of the screen.
> >
> > >> <snip>
> >
> > >> > As you can see I have the following line in the Button tag
> >
> > >> > -----------------------------------
> > >> > android:gravity="bottom"
> > >> > ------------------------------------
> >
> > >> > I thought this would move the button to the bottom but it still
> > >> > appears at the top of the screen under the text.
> >
> > >> You probably want android:layout_gravity="bottom". It's documented in
> > >> LinearLayout.LayoutParams in the SDK docs.
> >
> > >> --
> > >> Mark Murphy (a Commons Guy)http://commonsware.com
> >
> > >> Android Training on the Ranch! -- Mar 16-20, 2009
> http://www.bignerdranch.com/schedule.shtml
> >
> > --
> > Romain Guywww.curious-creature.org
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to