[android-beginners] Re: How to Align button to button of screen???

2009-10-27 Thread Matt Raffel

So that does not put my button at the bottom of the screen.  Is that 
because I am using a LinearLayout?

?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
 android:background=@drawable/blankscreen
 
TextView
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:text=@string/hello
 /

Button
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:gravity=bottom
 android:text=@string/btn_start_game
/

/LinearLayout




brucko wrote:
 Matt,
 
 The second text view cannot have height = fill parent
 
 On Oct 27, 6:23 am, Matt Raffel matt.raf...@gmail.com wrote:
 I tried that :)  I created a second textview control.  It ends up
 pushing the button off the bottom of the screen.

 TextView
  android:layout_width=fill_parent
  android:layout_height=wrap_content
  android:text=@string/hello
  /
 TextView
  android:layout_width=fill_parent
  android:layout_height=fill_parent  -- this will fill 
 screen and leave no room for Button
  android:text=@string/empty_string
  /
 Button
  android:layout_width=fill_parent
  android:layout_height=wrap_content
  android:gravity=bottom
  android:text=@string/btn_start_game
 /
 
 Use a Relative Layout instead as recommended by paul. Something like
 this may work ( I haven't checked - but you get the idea)
 
 ?xml version=1.0 encoding=utf-8?
 RelativeLayout xmlns:android=http://schemas.android.com/apk/res/
 android
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:background=@drawable/blankscreen
 
 TextView
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:text=@string/hello
 /
 
 Button
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:layout_alignParentBottom =true
 android:text=@string/btn_start_game
 /
 
 /RelativeLayout
 
  
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: How to Align button to button of screen???

2009-10-26 Thread Justin Anderson
Depending on what you want to do, with the space in the middle, you could
create a view that acts as an empty space holder and set its layout_height
attribute to fill_parent.

One simple way of doing this would be to use  a TextView that only displays
an empty string

--
There are only 10 types of people in the world...
Those who know binary and those who don't.
--


On Sun, Oct 25, 2009 at 7:59 PM, tatman matt.raf...@gmail.com wrote:


 I have two elements:  I want the text at the top of the screen and the
 button at the bottom with space between the two controls.How can I
 get the button to appear at the bottom of the screen?

 ?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
android:background=@drawable/blankscreen

 TextView
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=@string/hello
/

 Button
android:layout_width=fill_parent
android:layout_height=wrap_content
android:gravity=bottom
android:text=@string/btn_start_game
 /

 /LinearLayout

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: How to Align button to button of screen???

2009-10-26 Thread Paul Turchenko

Yet another way is to use RelativeLayout as a root element (instead of
LinearLayout) and set android:layout_alignTop and
android:layout_alignBottom on TextView and Button respectively.

On Oct 26, 8:58 pm, Justin Anderson janderson@gmail.com wrote:
 Depending on what you want to do, with the space in the middle, you could
 create a view that acts as an empty space holder and set its layout_height
 attribute to fill_parent.

 One simple way of doing this would be to use  a TextView that only displays
 an empty string

 --
 There are only 10 types of people in the world...
 Those who know binary and those who don't.
 --

 On Sun, Oct 25, 2009 at 7:59 PM, tatman matt.raf...@gmail.com wrote:

  I have two elements:  I want the text at the top of the screen and the
  button at the bottom with space between the two controls.    How can I
  get the button to appear at the bottom of the screen?

  ?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
     android:background=@drawable/blankscreen

  TextView
     android:layout_width=fill_parent
     android:layout_height=wrap_content
     android:text=@string/hello
     /

  Button
     android:layout_width=fill_parent
     android:layout_height=wrap_content
     android:gravity=bottom
     android:text=@string/btn_start_game
  /

  /LinearLayout
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: How to Align button to button of screen???

2009-10-26 Thread Matt Raffel

I tried that :)  I created a second textview control.  It ends up 
pushing the button off the bottom of the screen.


TextView
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:text=@string/hello
 /
TextView
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:text=@string/empty_string
 /
Button
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:gravity=bottom
 android:text=@string/btn_start_game
/

Matt

Justin Anderson wrote:
 Depending on what you want to do, with the space in the middle, you 
 could create a view that acts as an empty space holder and set its 
 layout_height attribute to fill_parent.
 
 One simple way of doing this would be to use  a TextView that only 
 displays an empty string
 
 --
 There are only 10 types of people in the world...
 Those who know binary and those who don't.
 --
 
 
 On Sun, Oct 25, 2009 at 7:59 PM, tatman matt.raf...@gmail.com 
 mailto:matt.raf...@gmail.com wrote:
 
 
 I have two elements:  I want the text at the top of the screen and the
 button at the bottom with space between the two controls.How can I
 get the button to appear at the bottom of the screen?
 
 ?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
android:background=@drawable/blankscreen

 TextView
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=@string/hello
/
 
 Button
android:layout_width=fill_parent
android:layout_height=wrap_content
android:gravity=bottom
android:text=@string/btn_start_game
 /
 
 /LinearLayout
 
 
 
 
  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---