tags:

views:

64

answers:

2

Hi

I'm trying create a scaling layout for an Android application. The whole screen should contain two areas. The top 3/4 of the screen should be a MapView showing a certain area. The remaining quarter of the screen should contain some textual information to certain places shown on the map.

So now I'm wondering what is the best practice to archive this layout the 3:1 ratio of the screen partition? Is there a way to set this ratio in the layout xml file or do I have to calculate and set it manually by code in the corresponding activity?

+1  A: 

Experiment with layout_weight attribute:

http://developer.android.com/guide/topics/ui/layout-objects.html#linearlayout

LordTwaroog
+2  A: 

try layout_weight.

set MapView to layout_weight="3", the remaining layout to layout_weight="1"

Andy Lin
You would also need to set their heights to be `0px` in the XML. That way, the weights will split up all the vertical space. Otherwise, the widgets will first get their "natural" size, then the rest would be split up based on weights.
CommonsWare