android:layout_weight 是什么意思? [英] What does android:layout_weight mean?

查看:31
本文介绍了android:layout_weight 是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白如何使用这个属性.谁能告诉我更多有关它的信息?

解决方案

使用 layout_weight 您可以指定多个视图之间的大小比例.例如.您有一个 MapView 和一个 table,它们应该向地图显示一些附加信息.地图应使用屏幕的 3/4,表格应使用屏幕的 1/4.然后设置maplayout_weight为3,tablelayout_weight为1.

要使其正常工作,您还必须将高度或宽度(取决于您的方向)设置为 0px.

I don't understand how to use this attribute. Can anyone tell me more about it?

解决方案

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.

这篇关于android:layout_weight 是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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