reactjs - 在视图中调整图像大小
问题描述
我的样式代码如下:
advertiseBox:{
flexDirection: 'row-reverse',
},
advertiseImage:{
alignItems: 'flex-start',
resizeMode: 'contain',
height: 200,
width: 300,
borderRadius: 7,
},
调用图像和样式如下:
<View style={[todayStyles.advertiseBox, {backgroundColor: 'blue'}]}>
<Image source={require('../../assets/images/advertise.png')} style={todayStyles.advertiseImage}/>
</View>
在代码中很明显没有使用边距和填充。为什么图像与顶部、底部和右侧有距离。问题的解决方案是什么?
解决方案
据此, resizeMode似乎不适用于 React Native 0.57 版中的 PNG
推荐阅读
- python - 将计算列添加到 df 的“if”“else”条件的 pandas 等效项
- fs - NodeJS (fs 模块) - 绝对文件路径附加到节点应用程序的 cwd
- keras - 检查输入时出错:预期 time_distributed_136_input 有 5 个维度,但得到了形状为 (16, 128, 128, 3) 的数组
- javascript - 在 JavaScript 中循环数组并使用拼接删除其所有元素?
- asp.net-mvc - 当用户需要更新信息时,Asp.net MVC 4 重定向
- html - 如何在 ReactJS 中的 div 中放置元素?
- amazon-cloudwatch - 如何在 python 用户定义函数中定义 amazon-cloudwatch boto3.client
- java - LibGDX 模型实例颜色未传递给顶点着色器
- r - 使用粘贴在数据集中自动命名
- python - 尝试在 python 中进行标签编码时,ValueError 包含新标签