1.在 style 属性中设置 width 和 height 确定组件的大小;
例:
<View style={{width:100,height:100.backgroundColor:'red'}} />
2.使用 flex 控制组件在空间中收缩;
注意:父组件必须设置了 witdh height 获取 flex ,子组件的 flex 设置才会生效;
例:
<View style={{width:100,height:100.backgroundColor:'red'}} />
注意:父组件必须设置了 witdh height 获取 flex ,子组件的 flex 设置才会生效;
本文标题:三 Width and Height
本文链接:https://www.haomeiwen.com/subject/gtbhnxtx.html
网友评论