android:layout_weight详解

android:layout_weight只在LinearLayout内部的控件才有的属性。

在LinearLayout的width为fill_parent,内部控件android:layout_width="wrap_content"时。weight为占的分量。

某个控件的宽度为weight/总weight。其实这个weight就是实现百分比设置宽度。

fill_parent有个特殊的用途。一行有很多控件。最后一个设置成fill_parent可以填充剩余空间。

如果在linearLayout中某控件在前,其他在后固定宽高,这个控件如果要填充剩余部分weight可设置成1.其他的为0。

我的话费充值店-各种面额
电信100元仅售98.60 

联通100仅售99.00
移动100仅售99.30

猜你喜欢

转载自wenzongliang.iteye.com/blog/1893320