【发布时间】:2018-07-18 15:57:50
【问题描述】:
我在 Image 标签中有一个 png 图像。部分图像具有透明背景。在我的安卓手机中,它显示为白色。我希望去除白色部分并使其透明。
这是我的代码 -
export default class LoginScreen extends Component {
render() {
return (
<View style={styles.container}>
<View style = {styles.topContainer}>
<Image style = {styles.logoContainer}
source = {require('../images/black_header.png')} />
</View>
</View>
);
}
}
const styles = StyleSheet.create({
logoContainer: {
resizeMode: 'contain',
backgroundColor: "rgba(0,0,0,0)",
width: null,
height: 254,
},
container: {
backgroundColor: "#f7f7f7"
},
topContainer: {
backgroundColor: "rgba(0,0,0,0)"
}
});
【问题讨论】:
-
提及为什么投反对票
-
它必须通过透明图像显示一些背景颜色。当前是否显示容器样式中定义的浅灰色?
-
@RobWalker 没有。它显示白色。