0

我使用普通图像标签来显示服务器图像,但有些图像显示正确,有些则没有。

  • 我正在将 react-native 用于 android 应用程序
  • 我使用 react-native-responsive-dimensions 来调整相对于屏幕大小的图像大小。
  • 通过状态传递图像 URL。

<View>
   <Image 
     style={{borderWidth:1,
     width: responsiveWidth(100),
     height: responsiveHeight(50),
     resizeMode:'contain'}} 
     source = {{ uri:this.state.productimage}}/>
</View>

这就是我的产品图片的样子

4

2 回答 2

1

if you want to display your server image in grid then may be this works for you

<Image source={{uri:"http://pngimg.com/uploads/google/google_PNG19632.png"}} style={{height:null,width:null,flex:0.5,resizeMode:'contain'}}  />

or change resizeMode:'cover'

于 2018-06-22T10:29:50.280 回答
0

以图像标签的样式提供高度-宽度

<Image 
source = {{ uri:"http://pngimg.com/uploads/google/google_PNG19632.png" }} 
style = {{ height:100, width:100 }}/>

于 2018-06-22T10:19:12.897 回答