如何设置样式归属以填充剩余空间? [英] How to set the style attribution to fill the rest space?

查看:52
本文介绍了如何设置样式归属以填充剩余空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如您所见,如果在父视图上已经添加了三个红色视图,则会显示该图像.现在,我想添加另一个可以填充其余空间的蓝色视图.如何设置样式?

As you see the image, if the three red views are already added on the parent view. Now I want to add another blue view which can fill the rest space. How can I set the style?

推荐答案

您可以尝试一下;

<View style={{flex:1,backgroundColor:'white'}}>
  <View style={{justifyContent:'space-around'}}>
    <View style={{height:50,alignSelf:'stretch',backgroundColor:'pink',margin:5}}/>  
    <View style={{height:50,alignSelf:'stretch',backgroundColor:'pink',marginHorizontal:5}}/>  
    <View style={{height:50,alignSelf:'stretch',backgroundColor:'pink',margin:5}}/>  
  </View>
  <View style={{flex:1,alignItems:'center',justifyContent:'center',alignSelf:'stretch',backgroundColor:'blue',margin:5}}>
    <Text style={{color:'white',fontWeight:'bold'}}>
      View
    </Text>
  </View>
</View>

这篇关于如何设置样式归属以填充剩余空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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