React Native 第三天
来源:互联网 发布:license 开发 node 编辑:程序博客网 时间:2024/06/08 14:50
7、JustifyContenr
justifyContenr是用来设置主轴内容的排列方式
属性值有:
flex-start:从开始位置排列
flex-end:从结尾位置排列
center: 居中排列
space-between:元素显示在起始和结束的两端
space-around:元素显示在轴起始和结束有一段距离的位置(中间间隔是两边靠边距离的两倍)
justifyContenr是不会改变元素的排列顺序,与FlexDirection中的方向翻转是不同的,FlexDirection的方向翻转会改变元素的排列位置
8、alignItems
alignItems用来设置交叉轴
属性值有:
flex-start:从开始位置排列
flex-end:从结束位置排列
center:居中排列
stretch:拉伸
9、alignSelf
align允许子元素和其他子元素不同,会覆盖alignItems的属性
属性值有:
auto:自动
flex-start:从开始的位置排列
flex-end:从结束的位置排列
center:居中排列
stretch:拉伸
设置在子元素的样式当中
10、左右两栏布局案例
import React, {Component} from 'react';import { AppRegistry, StyleSheet, Text, View} from 'react-native';export default class Main extends Component { render() { return ( <View style={styles.container}> <View style={styles.left}> <Text>{'left'}</Text> </View> <View style={styles.right}> <Text>{'right'}</Text> </View> </View> ); }}const styles = StyleSheet.create({ container: { flex: 1, flexDirection:'row' }, left: { flex: 1, backgroundColor: 'red' }, right: { flex: 1, backgroundColor: 'green' }});
实现了屏幕左右各一半的两栏效果
阅读全文
0 0
- React Native 第三天
- React Native学习第三天
- React Native 第十三天
- ReactNative学习第三天 UI篇 React-native-Swiper
- React Native 第一天
- React Native 第五天
- React Native 第七天
- React Native 第八天
- React Native 第九天
- React Native学习-第一篇
- React Native 开发(第一篇)
- 学习React Native的第一天
- React Native学习的第一天
- << React Native 入门与实战>>----第1章 React Native简介
- << React Native 入门与实战>>----第2章 React Native开发基础
- react native
- React Native
- React Native
- css3属性
- ssm+bootstrap验证练习01注册验证(方法一)之代码实现
- 最近转ARCGIS 三维二次开发了,开启新的分享与交流
- linxu之Vim快速入门
- JS 60秒后重发送验证码
- React Native 第三天
- oracle exists用法解析
- Solr查询与sql对比转化
- 【JAVA300】11-15 笔记
- JavaScript原型和闭包之---为对象添加属性和方法以及in 、delete关键字(一)
- 数据类型转换之 QString与char*
- js按位 或 与 运算
- (最易理解)51Nod
- 背包问题: HDU1114Piggy-Bank