我有一个问题,将我的图像放置在容器中,那就是当我给予图像position: absolute
和top
属性时,图像从顶部被裁剪,这是问题:
的数据
下面是我的代码:
<View style={styles.OurTherapistsContainer}>
<View style={styles.therapistCard}>
<View style={styles.imageContainer}>
<Image style={styles.image} source={require('../assets/img/leong.png')} />
</View>
</View>
</View>
...
therapistCard: {
width: 150,
height: 150,
borderRadius: 25,
borderWidth: 1,
borderColor: '#DFEEFF',
overflow: 'hidden',
},
imageContainer: {
width: 150,
height: 150,
backgroundColor: 'red',
},
image: {
width: '100%',
height: '100%',
position: "absolute",
top: 30
}
字符串
我该怎么弥补?
2条答案
按热度按时间y3bcpkx11#
尝试在图像样式中使用resizeMode,如
字符串
k5ifujac2#
将resizeMode设置为cover
字符串