Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fill_parent vs. allignPrentTop/Bottom

 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a tutorial on Android layouts (http://www.curious-creature.org/2009/02/22/android-layout-tricks-1/) I saw the following:



As I understand it, layout_height="fill_parent" means that the view will fill its parent vertically (no leap in logic there). That is, its top edge will align with the parent's top edge and its bottom edge will align with the parent's bottom edge.

And, as I understand it, the two alignParentXxx parameters also mean the the view's top and bottom edges will be aligned with those of its parent.

So, what's the difference? And why use both height and align?
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bump...
 
Maneesh Godbole
Saloon Keeper
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Disclaimer: I mostly use DroidDraw to get the basic layout and then tweak manually as required.

I think align top/bottom gives you finer control. top+bottom = fill parent. However you might have scenarios where you do not want fill parent but align top/bottom.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Maneesh. I'll check it out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic