如何在所有面显示卡片阴影?
How can I show a card shadow on all sides?
我有以下款式
card: {
backgroundColor: Colors.white,
borderRadius: 10,
marginRight: Metrics.WIDTH*0.02,
marginLeft: Metrics.WIDTH*0.02,
borderColor: Colors.SILVER,
borderWidth: 2,
shadowColor: 'gray',
shadowOffset: { width: 2, height: 2 },
shadowOpacity: 0.5,
shadowRadius: 2,
elevation: 10,
},
以上样式只在右侧和底部创建阴影。如何平等地创造全方位的对决
您不能在 React-Native 中添加多个阴影。但是有一个解决方法。
将shadowOffset
的width
和height
设置为零,然后尝试更改shadowRadius
直到您满意为止。
card:{
shadowOffset: { width: 0, height:0 },
shadowOpacity: 0.5,
shadowRadius: 10,
}
这是结果。
我有以下款式
card: {
backgroundColor: Colors.white,
borderRadius: 10,
marginRight: Metrics.WIDTH*0.02,
marginLeft: Metrics.WIDTH*0.02,
borderColor: Colors.SILVER,
borderWidth: 2,
shadowColor: 'gray',
shadowOffset: { width: 2, height: 2 },
shadowOpacity: 0.5,
shadowRadius: 2,
elevation: 10,
},
以上样式只在右侧和底部创建阴影。如何平等地创造全方位的对决
您不能在 React-Native 中添加多个阴影。但是有一个解决方法。
将shadowOffset
的width
和height
设置为零,然后尝试更改shadowRadius
直到您满意为止。
card:{
shadowOffset: { width: 0, height:0 },
shadowOpacity: 0.5,
shadowRadius: 10,
}
这是结果。