zoukankan      html  css  js  c++  java
  • flex布局居中无效果注意是否设置了宽度

    <View style={{display:'flex',marginTop:JDDevice.getRpx(20),backgroundColor:'#fff',flexDirection:'row',height:JDDevice.getRpx(185),alignItems:'center'}}>
                <JDTouchable style={styles.wraper} onPress={()=>{this._jumpShiYou()}}>
                  <View style={styles.imagesPox}><JDImage source={require('../images/petroleum.png')} style={styles.imgBox}/></View>
                  <View style={styles.word}><JDText>中国石油</JDText></View>
                </JDTouchable>
                <View style={styles.line}></View>
                <JDTouchable style={styles.wraper} onPress={()=>{this._jumpShiHua()}}>
                  <View style={styles.imagesPox}><JDImage source={require('../images/chemical.png')} style={styles.imgBox}/></View>
                  <View style={styles.word}><JDText>中国石化</JDText></View>
                </JDTouchable>
                <View style={styles.line}></View>
                <JDTouchable style={styles.wraper} onPress={()=>{this._judgeLogin()}}>
                  <View style={styles.imagesPox}><JDImage source={require('../images/card.png')} style={styles.imgBox}/></View>
                  <View style={styles.word}><JDText>壳牌</JDText></View>
                </JDTouchable>
              </View>

    View 是flex布局;JDTouchable是flex:1;设置居中,  里面的两个View必须提供宽度,才能居中!

  • 相关阅读:
    electrica writeup
    C++ Tips and Tricks
    net-force.nl/steganography writeup
    3*n/2
    C++ 关键字浅谈
    MindMaster激活教程
    gitignre
    python pil 安装
    ubuntu 阿里云安全配置
    阿里云 centos 环境配置与 django 部署
  • 原文地址:https://www.cnblogs.com/xiaozhumaopao/p/8029463.html
Copyright © 2011-2022 走看看