我想在我的反應原生android和iOS應用程序中顯示靜態圖像。它在iOS應用中運行良好。但我無法在Android應用程序中顯示圖像。以下是我的代碼:無法在Android中顯示靜態圖像與反應原生
<Image source ={require('../images/background.png')}
style ={styles.imageStyle}>
</Image>
var styles = StyleSheet.create({
container: {
flex: 1,
alignSelf: 'stretch'
},
imageStyle: {
flex: 1,
margin:10,
width: undefined,
height: undefined,
backgroundColor:'transparent',
justifyContent: 'center',
alignItems: 'center'
}
我已經把圖像「background.png」下繪製 - ** dpi的文件夾,以及根據所提到的圖片文件夾。
它適用於我的iOS應用程序從圖像文件夾中挑選圖像,但不適用於android。 我正在使用react-native版本0.33
在此任何幫助將不勝感激!
編輯: 它不會在這裏也工作:
<View key={answer.ID}>
<OnTouchHighlightWidget key={answer.ID} onPress={() => {this.props.onSelect(answer)}}>
<Image source={this.getImageUrl(answer)} style={{flex:1,margin:10,width: 90, height: 95}} />
</OnTouchHighlightWidget>
</View>
我已經把image_holo.png同一目錄下的js文件和相應的繪製 - ** DPI文件夾。它適用於iOS。但不是在Android上!
這是一個完整的封面背景圖片? – EQuimper
是的。這是一張背景圖片。 – Sachin