1.当layout_width与layout_height的值为wrap_content时设置一个layout_weight属性,则按照正常比例分配
2.当layout_width或layout_height的值为match_parent时设置layout_content则分配方法如下
假设layout_weight的值为1,2,3
step1.个个都是fill_parent,但是屏幕只有一个啦,那么1 - 3 = - 2 fill_parent
step2.依次比例是1/6,2/6,3/6
step3.先到先得,先分给one,计算: 1 - 2 * (1/6) = 2/3 fill_parent 接着到two,计算: 1 - 2 * (2/6) = 1/3 fill_parent 最后到three,计算 1 - 2 * (3/6) = 0 fill_parent
step4.
android中weight属性
最新推荐文章于 2023-05-16 15:38:39 发布