假设一个布局中有三个子布局,三个子布局的layout_weight属性占比我2 3 4
此时有两种情况:
1)wrap_content比较简单,直接就按比例得了
2)fill_content(match_content)则需要计算
计算方法为:1-子布局=a(a为负数)
子布局1占比:1+a*子布局1weight比重/总weight比重
依次计算,得到三个布局在屏幕的占比即可
LinearLayout中layout_weight属性占比计算方法
最新推荐文章于 2024-06-16 18:28:17 发布