Android上的React本机圆圈图像
我只是想在Android上的react本机应用程序中拍摄一张方形图像,并将其包含在一个圆圈内。基本上是一个圆形图像Android上的React本机圆圈图像,android,image,reactjs,react-native,Android,Image,Reactjs,React Native,我只是想在Android上的react本机应用程序中拍摄一张方形图像,并将其包含在一个圆圈内。基本上是一个圆形图像 <View style={mainStyle.profileImageContainer}> <Image style={mainStyle.profileImage} source={{uri: CONFIG.media_url+this.props.image}}
<View style={mainStyle.profileImageContainer}>
<Image
style={mainStyle.profileImage}
source={{uri: CONFIG.media_url+this.props.image}}
resizeMode="cover"
/>
</View>
但在Android上实现远程循环的唯一方法是添加“OverlyColor”,但我需要它是透明的,以便后面的设计可见。透明属性不起作用
有人知道如何做到这一点吗?我是否缺少某种简单的属性
编辑:多亏了Dhruv Parmar的回答,我意识到这个问题是因为我使用了GIF图像。您所期望的方法似乎适用于JPG和PNG,但不适用于GIF 实现这一点不需要包装视图,只需将
borderRadius
设置为图像大小的一半即可。您需要的任何其他样式都可以直接应用于图像
视图
你可以在这里看到一个例子
使用这种风格
您能否显示您的图像当前的显示方式?
profileImageContainer: {
translateY: -43,
alignSelf: 'center',
},
profileImage: {
resizeMode: 'cover',
height: 86,
width: 86,
borderWidth: 2,
borderRadius: 75,
overlayColor: CREAM,
},
image: {
width: 150,
height: 150,
borderRadius: 150 / 2,
overflow: "hidden",
borderWidth: 3,
borderColor: "red"
}