javascript - 缩略图的背景颜色
问题描述
我正在使用缩略图。在 iconfinder 图像中,cross
是透明的并采用 main 的背景颜色container
。
我希望十字架是白色的,周围是黑色的。
export const Screen: React.FunctionComponent = () => {
return (
<SafeAreaView style={styles.safeAreaViewContainer}>
<View style={styles.container}>
<View style={styles.iconsContainer}>
<TouchableOpacity
style={styles.cross}>
<Thumbnail
source={{
uri:
'https://cdn0.iconfinder.com/data/icons/very-basic-android-l-lollipop-icon-pack/24/close-512.png',
}}
/>
</TouchableOpacity>
</View>
</View>
</SafeAreaView>
);
};
export const styles = StyleSheet.create({
safeAreaViewContainer: {
flex: 1,
},
container: {
backgroundColor: '#323443',
flex: 1,
},
cross: {
paddingTop: moderateScale(30),
paddingLeft: moderateScale(20),
zIndex: 100,
},
});
cross
如果我向或添加背景颜色TouchableOpacity
,则会出现超出缩略图的白色块。我还能如何实现这一目标?
如果我向缩略图本身添加样式:
thumbnail:{
backgroundColor: 'white',
}
我明白了,这不是我想要的。我不想要边框轮廓。
缩略图: https ://cdn0.iconfinder.com/data/icons/very-basic-android-l-lollipop-icon-pack/24/close-512.png
解决方案
我不认为这是边框轮廓...尝试减小图标容器/白色区域的半径以匹配您正在使用的 png 文件的半径。
推荐阅读
- r - R magick:方形裁剪和圆形蒙版
- azure-aks - 使用 Azure 上的 AMLS 的内部负载均衡器预配 AKS
- python-3.x - 这个 Tkinter 程序有什么问题
- laravel - 在集合上使用 WhereRaw 会忽略关系
- flutter - 渡槽模板 db_and_auth 未呈现登录表单
- android - Android-Webrtc:AndroidVideoDecoder 的 copyI420Buffer() 中出现断言错误
- javascript - Javascript 将新对象分配给函数原型,删除实例和函数原型之间的链接
- python-3.x - 变量计数在 for 循环内不增加
- hyperledger-fabric - 如何使用节点 sdk 在超级账本结构中获取具有块哈希的资产历史记录
- prolog - 在 Prolog 中通过 Quine 算法计算估值的数量