close

13.png

設置組件尺寸最簡單的方法是添加width與height之固定尺寸

接下來修改在[筆記]安裝React-Native與創造第一個專案,所創造的專案來演示width與height

03.JPG

export default class AwesomeProject extends Component {
  render() {
    return (
      <View>
        <View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
        <View style={{width: 100, height: 100, backgroundColor: 'skyblue'}} />
        <View style={{width: 150, height: 150, backgroundColor: 'steelblue'}} />
      </View>
    );
  }
}

在Node.js command prompt執行"react-native run-android",即可安裝在模擬器或手機上演示,

04.JPG

arrow
arrow

    鄭智遠 發表在 痞客邦 留言(0) 人氣()