Thursday, May 24, 2012

android - important points

first of all RelativeLayout ignores layout_gravity. Then you need to know that 

  • gravity means "apply gravity to the content of this view" 
whereas 
  • layout_gravity means "apply gravity to this view within its parent." 



So on a TextView, gravity will align the text within the bounds of the TextView whereas layout_gravity will align the TextView within the bounds of its parent.



  • MATCH_PARENT, which means the view wants to be as big as its parent (minus padding)
  • WRAP_CONTENT, which means that the view wants to be just big enough to enclose its content (plus padding).
A TableLayout can specify certain columns as shrinkable or stretchable
by calling setColumnShrinkable() or setColumnStretchable(). If marked as shrinkable, the column width can be shrunk to fit the table into its parent object. If marked as stretchable, it can expand in width to fit any extra space. The total width of the table is defined by its parent container.