<Image
style={styles.Img}
source={require('./Images/x.png')}>
</Image>
Img:{
width:200,height:200,resizeMode: 'contain'
}
我正在学习React Native。不确定怎么做。需要标题低于图像和中心对齐。我正在使用Android
答案 0 :(得分:4)
检查以下样本。
import React, {Component} from 'react';
import {AppRegistry, Text, Image, View} from 'react-native';
class StackOveflow extends Component {
render() {
return (
<View style={{flex:1,alignItems:'center',justifyContent:'center'}}>
<Image
style={{width:200,height:200}}
source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}}
/>
<Text> Hello world! </Text>
</View>
);
}
}
AppRegistry.registerComponent('StackOveflow', () => StackOveflow);
请告诉我这是否适合您。