【问题标题】:I am not able to see the shadow on my app我无法在我的应用上看到阴影
【发布时间】:2021-11-24 02:05:10
【问题描述】:

我正在尝试使用 react native 在 android 应用程序中对我的文本应用阴影,但我根本看不到阴影。 这是我的代码:

const styles = StyleSheet.create({
viewStyle:{
    backgroundColor:'pink',
    justifyContent:'center',
    alignItems:'center',
    height:60,
},
textStyle:{
    fontSize:20
},
shadow:{shadowColor:'black',
    shadowOffset:{width:10,height:10},
    shadowOpacity:0.2
}

});

【问题讨论】:

    标签: reactjs react-native react-native-android


    【解决方案1】:

    如果您使用的是 Android,一切正常。

    These are properties that only apply to iOS:

    • shadowOffset;
    • 阴影不透明度;
    • 阴影半径。

    要在 Android 上管理影子,您必须使用 elevation 参数。

    在这里您可以找到更详细的答案:How to set shadows in React Native for android?

    【讨论】:

    • 哦!非常感谢!我用的是安卓。
    猜你喜欢
    • 1970-01-01
    • 2023-03-27
    • 1970-01-01
    • 1970-01-01
    • 2018-04-28
    • 2023-03-08
    • 1970-01-01
    • 2020-05-02
    • 1970-01-01
    相关资源
    最近更新 更多