Android的百分比布局高度 [英] Android Percentage Layout Height
问题描述
我知道这是不可能的设置比例,并且可以设置特定图像的重量来扩展他们的高度。我所试图做的虽然是指定的布局相对布局是在高度。 Basicly我有这样的事情
I know that it is impossible to set percentages and that you can set a weight of certain images to scale their heights. What I am trying to do though is specify the height of a layout relative to the layout it is within. Basicly I have something like this
<LinearLayout android:layout_height="fill_parent">
<LinearLayout>
</LinearLayout>
</LinearLayout>
当然,这是一个非常简化的版本,只是让你能理解我的胡言乱语。 Basicly我想设置内的LinearLayout是大约50%的主要的LinearLayout的。
Of course this is a very simplified version, just so you can understand my gibberish. Basicly I want to set the inner linearlayout to be around 50% of the main linearlayout.
什么是做到这一点的最好方法是什么?
What is the best way to do this?
推荐答案
您可以加入一个空的布局下面一个,并设置他们俩有相同的布局重量。他们应该得到的每个面积的50%。
You could add another empty layout below that one and set them both to have the same layout weight. They should get 50% of the space each.
这篇关于Android的百分比布局高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!