android - React Native 填充图标的透明部分
<p><p>我使用的 youtube 图标来自:<a href="https://github.com/oblador/react-native-vector-icons" rel="noreferrer noopener nofollow">https://github.com/oblador/react-native-vector-icons</a> </p>
<p>我使用的是来自 Ionicons 的“logo-youtube”,我希望中间播放三 Angular 形(透明)为白色,而周围部分为红色,但是如果我添加白色背景颜色,则会有一个图标周围的白色框,并且将填充设置为 0 根本没有任何作用。如何在不让整个图标周围出现背景框的情况下让透明中间着色?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我也遇到了类似的问题,但我找到了一种用任何颜色填充透明部分的方法。
添加一个带有位置的虚拟 View :'absolute'</p>
<pre><code>//jsx
<View style={styles.fillView}/>
<Icon /> {*your Icon*}
//style
fillView:{
position:'absolute',
width:10,
height:10,
top:40,
left:90,
backgroundColor:'any fill color here'
}
</code></pre>
<p>您可以调整宽度、高度样式以匹配填充部分的大小和顶部、左侧样式以匹配填充部分的位置。</p></p>
<p style="font-size: 20px;">关于android - React Native 填充图标的透明部分,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/46973806/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/46973806/
</a>
</p>
页:
[1]