边界不透明度-React Native

问题描述 投票:1回答:2

我将边框应用于“视图”,我想知道如何更改边框的不透明度。

<View style={styles.mainContainer}> </View>

mainContainer: {
 borderWidth: 2,
 borderColor: '#ddd',
 ....
 opacity: 2,
 ....
}

当我应用上述样式时,它不起作用。

css react-native border opacity
2个回答
0
投票

您无法在Android中使用react native height属性更改边框的不透明度。但在ios中,您可以使用

仅限IOS

=> shadowColor

=> shadowOffset

=> shadowOpacity

=> shadowRadius

用于更改阴影不透明度的属性。

有关更多文档,您可以检查https://facebook.github.io/react-native/docs/0.6/view-style-props


0
投票

尝试使用borderColor: rgba(158, 150, 150, .5);,其中最后一个参数定义不透明度,范围从0到1

© www.soinside.com 2019 - 2024. All rights reserved.