<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必须提供宽度,才能居中!