android - 反应原生 Android 图像在 resizeMode:'contain' 上模糊
问题描述
我正在使用虚拟设备在 Android Studio 上测试 react-native 应用程序,我在包含的图像的背景上得到了这些模糊标记。它在 iOS 上运行良好,但在 Android 上看起来不一样。
(问题图片)https://i.redd.it/qoptkvhzbct21.png
我已经尝试更改图像的背景颜色,但它并没有改变。
<View style={styles.imageContainer}>
<Image
source={{ uri: `https://devUrl/${this.props.image}`}}
style={{
flex: 1,
width: null,
height: null,
resizeMode: 'contain',
borderWidth: 1,
borderColor: 'transparent',
borderRadius: 10,
}}
/>
</View>
styles.imageContainer: {
height: 500,
flexDirection: 'row',
borderTopRightRadius: 10,
borderTopLeftRadius: 10,
paddingTop: 0,
paddingLeft: 0,
paddingRight: 0,
backgroundColor: 'white'
},
编辑:原来这是一个问题,你不能在 Android 设备上使用 resizeMode: 'contain' 。我使用图像的纵横比并设置容器高度。
解决方案
推荐阅读
- npm - 无法在 Mac 上安装 skpm
- java - 为什么我在这个 unmodifiableSet 上得到 ConcurrentModificationException?
- java - 如何在 Android Studios 中解决事件日志“所有文件都是最新的”
- python - Gtk3 在大量计算开始之前隐藏一个对话框(pyGtk)
- javascript - 间隔调用 API 以避免泛滥
- python-3.x - ValueError: view limit minimum 0.0 小于 1 并且是无效的 Matplotlib 日期值。
- lua - Lua - 我如何编辑注册表?
- opengl - OpenGL 中的颜色命令问题
- bash - BASH 脚本 - 不是预期的输出?
- jenkins - 詹金斯管道构建 NoClassDefFoundError