Android百分比布局高度 [英] Android Percentage Layout Height

查看:31
本文介绍了Android百分比布局高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道无法设置百分比,并且您可以设置某些图像的权重来缩放它们的高度.我想做的是指定布局相对于它所在布局的高度.基本上我有这样的东西

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>

当然这是一个非常简化的版本,只是为了你能理解我的胡言乱语.基本上我想将内部线性布局设置为主要线性布局的 50% 左右.

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.

最好的方法是什么?

推荐答案

您可以在该布局下方添加另一个空布局,并将它们设置为具有相同的布局权重.他们每个人应该获得 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆