Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

本地图片没有展示 #17

Closed
jianfengye opened this issue Oct 4, 2015 · 2 comments
Closed

本地图片没有展示 #17

jianfengye opened this issue Oct 4, 2015 · 2 comments

Comments

@jianfengye
Copy link

按照文档中说的:

https://facebook.github.io/react-native/docs/image.html#content

我将图片放入app/src/main/res/mipmap-xxhdpi/splash_logo.png

在代码中使用:

'use strict';

var React = require('react-native');

var {
  View,
  StyleSheet,
  Text,
  Image,
  Dimensions
} = React;

var WINDOW_WIDTH = Dimensions.get('window').width;

var StartScreen = React.createClass({

    render: function() {
        return (
            <View style={styles.container2}>
                <Image
                    style={styles.imagetop}
                    source={{uri:'http://img.qcds.com/ee978b96d3822476d4372dbe131d7f3a.jpg'}}
                />
                <Image
                    style={styles.imagedown}
                    source={require("image!ic_launcher")}
                />
            </View>
        );
    }
});


var styles = StyleSheet.create({
    container2: {
        flex:1,
        flexDirection: 'column'
    },
    imagetop: {
        flex: 3,
        width: WINDOW_WIDTH,
    },
    imagedown: {
        flex:1,
        width: WINDOW_WIDTH,
    },
});

module.exports = StartScreen;

发现的问题就是本地的图片没有展示,但是网络加载的图片有展示

即imagedown没有显示出来。。。

我也按照文档的说明,重新在Android Sudio中rebuild这个项目了,然后重新Run项目了

不清楚还有哪里可能错了?

求助,能不能帮忙看下有可能我哪里还有设置错误?

@race604
Copy link
Owner

race604 commented Oct 4, 2015

请把图片放到 drawable- 相关的文件夹中,不要放到mipmap- 中。

@jianfengye
Copy link
Author

谢谢老大,是放错文件夹了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants