【发布时间】:2018-06-30 08:33:18
【问题描述】:
我正在用 react-native 制作一个应用程序,我必须在其中显示用户的个人资料图片。 I want to make UI of somewhat this type 。如附图所示,我们可以看到个人资料图片略微向上移动,具有图像背景。
我已经写了代码,但是整个个人资料图片都移到上面了
render() {
return (
<Container style={{ backgroundColor: '#FFFFFF', }}>
<Content>
<Image source={{ uri: 'https://firebasestorage.googleapis.com/v0/b/reactnativechatapp-6f7eb.appspot.com/o/Ontro%20Copy%209.png?alt=media&token=2ede2451-0a14-4988-a9e2-ba88bab2c844' }}
style={styles.image}>
<View style={{
flexDirection: 'row', alignItems: 'flex-end', marginTop: 15,
justifyContent: 'flex-start', marginLeft: 20,
flex: 1
}}>
<Thumbnail source={{ uri: 'https://placeimg.com/640/480/people' }} />
</View>
</Image>
<View style={{
flexDirection: 'row', alignItems: 'flex-start',
justifyContent: 'flex-start', marginLeft: 40,
backgroundColor: '#FFFFFF', flex: 1
}}>
<View style={{ flexDirection: 'column', marginTop: 10, marginBottom: 15 }}>
<Text style={{ color: '#9F2232', marginLeft: 15, fontSize: 22, }}>Cecelia Fletcher</Text>
<Text style={{ color: '#9E9C9E', marginLeft: 15, fontSize: 12, }}>West Mambalam</Text>
</View>
</View>
<Separator />
如何为所附图片中的个人资料图片制作这种类型的 UI。
【问题讨论】:
-
您是否尝试在顶部图像上使用负边距底部?还是底部图像上的负 marginTop?
-
不,我没用过。你能通过更改我的代码来解释我吗
-
我试过是说无效的道具
-
负边距不起作用
-
负边距裁剪android上的底部图像
标签: javascript reactjs react-native flexbox react-native-android