我想设计一条横线,上面有一个图标,比如这一个,但是在react本机中。朝以下方向发展的事物:
<View style={{}}>
<View style={{}}>
<Image style={{}} source={}/>
</View>

我该怎么做?
发布于 2018-04-03 16:11:42
试试这段代码
import React, { Component } from 'react';
import { StyleSheet, View, Image } from 'react-native';
export default class App extends Component {
render() {
return (
<View style={{ paddingTop: 100, alignItems: 'center' }}>
<View style={{ borderBottomColor: '#bdbdbd', borderBottomWidth: 1, width: '90%' }} />
<View style={{ position: 'relative' }}>
<Image
style={styles.image}
source={{
uri: 'http://www.cgbconstrucciones.com/en/templates/rt_clarion/images/icons/green-leaf-icon.png',
}}
/>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
image: {
width: 40,
height: 40,
position: 'absolute',
top: -20,
left: -20,
backgroundColor: '#fff'
}
});发布于 2018-04-03 17:09:39
<View style={{flexDirection: 'row', alignItems: 'center'}}>
<View style={{flex: 1, borderBottomColor: '#bdbdbd', borderBottomWidth: 1}} />
<Image style={{width: 40, height: 40}}
source={{
uri: 'http://www.cgbconstrucciones.com/en/templates/rt_clarion/images/icons/green-leaf-icon.png',
}}/>
<View style={{flex: 1, borderBottomColor: '#bdbdbd', borderBottomWidth: 1}} />
</View>https://stackoverflow.com/questions/49632734
复制相似问题