I can't understand this attribute. Who can tell about it?
http://developer.android.com/guide/topics/ui/layout-objects.html#linearlayout
layout_weight defines how much space the control must obtain respectively to other controls.
Specifies how much of the extra space in the layout to be allocated to the View.
LinearLayout supports assigning a weight to individual children. This attribute assigns an "importance" value to a view, and allows it to expand to fill any remaining space in the parent view. Default weight is zero
calculation to assign any remaining space between child
space assign to child = (child individual weight) / (sum of weight of every child in Linear Layout)
Example (1): if there are three text boxes and two of them declare a weight of 1, while the third one is given no weight (0), then remaining space assign to
1st text box = 1/(1+1+0) 2nd text box = 1/(1+1+0) 3rd text box = 0/(1+1+0)
Example (2) : let's say we have a text label and two text edit elements in a horizontal row. The label has no layout_weight specified, so it takes up the minimum space required to render. If the layout_weight of each of the two text edit elements is set to 1, the remaining width in the parent layout will be split equally between them (because we claim they are equally important).
calculation : 1st label = 0/(0+1+1) 2nd text box = 1/(0+1+1) 3rd text box = 1/(0+1+1)
If the first one text box has a layout_weight of 1 and the second text box has a layout_weight of 2, then one third of the remaining space will be given to the first, and two thirds to the second (because we claim the second one is more important).
calculation : 1st label = 0/(0+1+2) 2nd text box = 1/(0+1+2) 3rd text box = 2/(0+1+2)
With layout_weight you can specify a size ratio between multiple views. E.g. you have a MapView and a table which should show some additional information to the map. The map should use 3/4 of the screen and table should use 1/4 of the screen. Then you will set the layout_weight of the map to 3 and the layout_weight of the table to 1.
To get it work you also have to set the height or width (depending on your orientation) to 0px.