我们在react-native (doc)中有proptype elevation,但是我如何设置它生成的“android-elevation”的颜色呢?
发布于 2016-09-16 06:46:08
不幸的是,安卓setElevation生成的阴影颜色无法更改。此外,他们在here等网站上的材料设计指南似乎并没有表明你可以改变颜色。
https://developer.android.com/training/material/shadows-clipping.html
此外,基于this的安卓系统也不支持React Native中的长方体阴影。
发布于 2019-02-19 19:50:37
如果使用elevation,则可以使用View#setOutlineAmbientShadowColor(int color)和View#setOutlineSpotShadowColor(int color)更改从API28 (Pie)开始的视图上的阴影颜色。
发布于 2018-01-25 15:10:30
根据@rclai的回答,您不能在Android中更改立面颜色。
你可以尝试这个React Native Shadow库,它使用svg生成阴影,让你设置颜色,偏移,不透明度,而不是使用高程:https://github.com/879479119/react-native-shadow
https://stackoverflow.com/questions/39514252
复制相似问题