RN8_React-Native知识点2之-布局
2017-02-22 09:59
211 查看
RN8_React-Native知识点2之-布局
参考:
http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html
http://www.ruanyifeng.com/blog/2015/07/flex-examples.html
通过权值设置:
2. flex-wrap
3. flex-flow
4. justify-content
5. align-items
6. align-content
flex-direction:row |row-reverse |column |column-reverse;
}
.box{
flex-wrap:nowrap (默认)|wrap|
wrap-reverse;
}
Nowrap:
Wrap:
wrap-reverse:
.box {
}
}
/>
/>
/>
http://www.ruanyifeng.com/blog/2015/07/flex-examples.html
参考:
http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html
http://www.ruanyifeng.com/blog/2015/07/flex-examples.html
Flex布局
宽度设置:
默认值:
flex的元素如果不设置宽度,都会百分之百的占满父容器。设置了宽度则按照宽度值设置。通过权值设置:
百分比:
Flex属性
1. flex-direction2. flex-wrap
3. flex-flow
4. justify-content
5. align-items
6. align-content
flex-direction
.box {flex-direction:row |row-reverse |column |column-reverse;
}
flex-wrap
定义了如果一条轴线排不下,如何换行。.box{
flex-wrap:nowrap (默认)|wrap|
wrap-reverse;
}
Nowrap:
Wrap:
wrap-reverse:
justify-content
定义了项目在主轴上的对齐方式。.box {
justify-content:
flex-start|flex-end |center | space-between |space-around;
}
align-items
.box {align-items:
flex-start|flex-end | center| baseline | stretch;
}
网格布局
1、等分网格布局
2、不等分表格
图片布局
在图片布局中,有三种mode:contain, cover, stretch。Contain模式:
<Image style={{flex: 1, height:100, resizeMode: Image.resizeMode.contain}} source={{uri:'http://gtms03.alicdn.com/tps/i3/TB1Kcs5GXXXXXbMXVXXutsrNFXX-608-370.png'}}/>
Cover模式
<Image style={{flex: 1, height:100, resizeMode: Image.resizeMode.cover}} source={{uri: 'http://gtms03.alicdn.com/tps/i3/TB1Kcs5GXXXXXbMXVXXutsrNFXX-608-370.png'}}/>
Stretch模式
<Image style={{flex: 1, height:100, resizeMode: Image.resizeMode.stretch}} source={{uri:'http://gtms03.alicdn.com/tps/i3/TB1Kcs5GXXXXXbMXVXXutsrNFXX-608-370.png'}}/>
布局练习
参考:http://www.ruanyifeng.com/blog/2015/07/flex-examples.html
相关文章推荐
- RN8_React-Native知识点3之-基本控件(2)
- RN8_React-Native知识点1之-Navigator导航学习
- RN8_React-Native知识点3之-基本控件(1)
- 《React-Native系列》11、 图解RN布局之FlexBox,三分钟上手写RN界面
- RN(react native)入坑指南-04,布局容器
- React Native实战之flexbox布局(RN基础)
- RN布局(四)——在React Native中使用flexbox
- React Native-3.React Native中的主要布局属性介绍和练习
- React Native入门——布局实践:开发京东客户端首页(二)TabBar的构建
- React-Native 基础(六) 使用Flexbox布局
- 《React-Native系列》21、 解决RN在Android下不支持gif问题
- [Wondgirl]从零开始学React Native之FlexBox布局(三)
- 学习ReactNative开发 小知识点记录
- react-native学习(RN)--之Window环境下搭建环境配置,以及初始化建立react-native项目,(真机和模拟器运行的相关错误解决办法,android打包报错)
- React Native系列之flexbox布局详解
- react-native 之布局篇
- React-Native 之控件布局
- React Native基础入门之初步使用Flexbox布局
- React Native 学习笔记之--布局
- 【ReactNative】react-native 布局