zoukankan      html  css  js  c++  java
  • react-native 学习之Image篇

    /**
     * Sample React Native App
     * https://github.com/facebook/react-native
     */
    'use strict';
    import React, {
      AppRegistry,
      Component,
      StyleSheet,
      Text,
      View,
      Image
    } from 'react-native';
    
    class machaoProject extends Component {
      render() {
        return (
          <View style={styles.container}>
            <View style={ styles.topBgView}>
           
           
            <View style={styles.unitView} >
                <Image 
                    source={require('./Images/001.png')}
                    style={styles.imageStyle}
                    />
                 <Text style = {styles.textStyle}>
                 美食
                 </Text>
            </View>
            
            <View style={styles.unitView} >
                <Image 
                    source={require('./Images/002.png')}
                    style={styles.imageStyle}
                    />
                 <Text style = {styles.textStyle}>
                 电影
                 </Text>
            </View>
            
            <View style={styles.unitView} >
                <Image 
                    source={require('./Images/003.png')}
                    style={styles.imageStyle}
                    />
                 <Text style = {styles.textStyle}>
                 酒店
                 </Text>
            </View>
            
            <View style={styles.unitView} >
                <Image 
                    source={require('./Images/004.png')}
                    style={styles.imageStyle}
                    />
                 <Text style = {styles.textStyle}>
                 KTV
                 </Text>
            </View>
            </View>
            
            
            <View style = {styles.topBgView}> 
            
            <View style={styles.unitView} >
                <Image 
                    source={require('./Images/005.png')}
                    style={styles.imageStyle}
                    />
                 <Text style = {styles.textStyle}>
                 外卖
                 </Text>
            </View>
            
             <View style={styles.unitView} >
                <Image 
                    source={require('./Images/006.png')}
                    style={styles.imageStyle}
                    />
                 <Text style = {styles.textStyle}>
                 优惠买单
                 </Text>
            </View>
            
             <View style={styles.unitView} >
                <Image 
                    source={require('./Images/007.png')}
                    style={styles.imageStyle}
                    />
                 <Text style = {styles.textStyle}>
                 你说呢
                 </Text>
            </View>
            
            </View>
         
         
            
            
          </View>
        );
      }
    }
    
    const styles = StyleSheet.create({
      container: {
        marginLeft: 5,
        marginTop: 20,
        marginRight: 5,
      },
      topBgView: {
        flexDirection: 'row',
        backgroundColor: 'red',
        marginTop: 10,
      },
      unitView: {
           70 ,  
      },
      imageStyle: {
         alignSelf: 'center',
          45,
         height: 45, 
      },
      textStyle: {
          marginTop: 0,
          textAlign: 'center',
          fontSize: 15,
          color: '#555555'
      }
    });
    
    AppRegistry.registerComponent('machaoProject', () => machaoProject);

  • 相关阅读:
    luogu3242 接水果 (整体二分+树状数组)
    [BZOJ3449] [Usaco2014 Feb]Secret Code
    [BZOJ2821] 作诗(Poetize)
    [BZOJ2434] [Noi2011]阿狸的打字机
    [BZOJ1212] [HNOI2004]L语言
    [JZOJ100026]【NOIP2017提高A组模拟7.7】图
    [BZOJ2467] [中山市选2010]生成树
    [Luogu3868] [TJOI2009]猜数字
    [POJ1006] Biorhythms
    [BZOJ2733] [HNOI2012]永无乡
  • 原文地址:https://www.cnblogs.com/machao/p/5282853.html
Copyright © 2011-2022 走看看