React-Native 基础(五) Height and Width
来源:互联网 发布:南方大数据300a怎么样 编辑:程序博客网 时间:2024/05/29 17:30
参考文档:http://facebook.github.io/react-native/docs/height-and-width.html
1. Fixed Dimension 静态尺寸
React-Native所有尺寸都是无单位,密度无关像素
import React, { Component } from 'react';import { AppRegistry, View } from 'react-native';class FixedDimensionsBasics 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> ); }};AppRegistry.registerComponent('AwesomeProject', () => FixedDimensionsBasics);
2. Flex Dimension 动态尺寸
import React, { Component } from 'react';import { AppRegistry, View } from 'react-native';class FlexDimensionsBasics extends Component { render() { return ( // Try removing the `flex: 1` on the parent View. // The parent will not have dimensions, so the children can't expand. // What if you add `height: 300` instead of `flex: 1`? <View style={{flex: 1}}> <View style={{flex: 1, backgroundColor: 'powderblue'}} /> <View style={{flex: 2, backgroundColor: 'skyblue'}} /> <View style={{flex: 3, backgroundColor: 'steelblue'}} /> </View> ); }};AppRegistry.registerComponent('AwesomeProject', () => FlexDimensionsBasics);
flex类似于Android的weight,不作过多解释
0 0
- React-Native 基础(五) Height and Width
- 基础篇章:React Native之Flexbox的讲解(Height and Width)
- React Native 之 width与height
- 混合开发的大趋势之一React Native Height and Width (尺寸),Flexbox(位置关系)
- React Native学习笔记(五)Redux基础学习
- React Native 入门(五)
- 【React Native】React基础(二)
- Set Height and Width Pie Chart
- studyjams notes 1B--width and height
- 得到屏幕的Width And Height
- web-屏幕、浏览器、页面-width and height
- React Native基础与入门(二)--初识React Native
- React Native从零开始(五)Text
- React Native 五:手势
- width height
- react native and redux
- yuv420sp crop from any startpoint and width and height
- react-native--基础(方法调用)
- 你编译你的代码
- tabbaritem设置红点大小、自定义宽高
- 训练计划
- 客户端往服务端定时发送消息
- java is bad
- React-Native 基础(五) Height and Width
- 再谈魔镜VR第一人称
- LINUX入侵检测指导
- 做点Postgresql笔记
- 题目96 n-1位数
- 基于STM32和W5500的Modbus TCP通讯
- I/O多路转接之select
- 多个UITableView 或者Scrollview 置顶问题
- 机器学习面试问题6