ReactNative中的布局
来源:互联网 发布:mindmanager for mac 编辑:程序博客网 时间:2024/05/03 17:47
ReactNative的布局模型
写的好,点个赞吧!写的不好,帮忙指出内容的不足,灰常感谢,希望与同行进行交流~~
ReactNative采用的布局模型是css中的flex模型,对其做了一点点的改动,因此,会先介绍CSS的flex布局模型,然后再简单的说明差异
CSS中的Flex布局模型
需要注意的是flex布局模型只是显示模型中的一种,不能误以为css只能这么做
网上有一篇文章写的贼好,把该说的都说清楚了。我就不做重复工作了。
戳这里
总结下布局其所做的事情:
1. 决定主轴方向
2. 决定主轴子元素对齐方式
3. 决定次轴子元素对齐方式
4. 当主轴上满了时,是否进行换行
5. 子元素修改自身对齐方式
6. 子元素分享剩余空间(正,负分享)
ReactNative支持的属性
Reactnative样式官网地址
对css flex 支持不全,列出差异性
当flex取正整数值时, is a positive number, it makes the component flexible and it will be sized proportional to its flex value. So a component with flex set to 2 will take twice the space as a component with flex set to 1.
When flex is 0, the component is sized according to width and height and it is inflexible.
When flex is -1, the component is normally sized according width and height. However, if there’s not enough space, the component will shrink to its minWidth and minHeight.
列出通用的属性写法,与原生多数类似,长度的单位都是逻辑像素,相当于dp
minwidth,maxwidth 多了最大最小 外边距 margin,marginTop,marginLeft,marginBottom,
marginRight,marginHorizontal,marginVerticall 多了垂直和水平外边距两种写法 内边距离 padding,paddingLeft,paddingBottom,paddingTop,
paddingRight,paddingHorizontal,paddingVerticall 多了垂直和水平内边距两种写法 边框宽度 borderBottomWidth, borderLeftWidth,borderRightWidth ,
borderTopWidth ,borderWidth 这个也是新增的,相对于android 相对位置 left,top,right,bottom 相对自身的原始位置,或者是父控件的位置,取决于position属性 相对位置的基准 position ‘absolute’(相对于父控件), ‘relative’(相对于自身) 层叠顺序 zindex 当重叠的时候怎么进行展示,值越大越处于上面 溢出处理 overflow 当控件超出边界的时候着进行处理,有 ‘visible’, ‘hidden’, ‘scroll’
- ReactNative中的布局样式
- ReactNative中的布局
- ReactNative 布局
- ReactNative布局
- 【ReactNative】react-native 布局
- ReactNative之Flexbox布局
- ReactNative FlexBox布局
- 【ReactNative】react-native 布局
- ReactNative flex 弹性布局
- ReactNative布局基础
- ReactNative 样式布局小结
- ReactNative开发之布局组件
- 实战了解ReactNative布局原理
- reactNative中的通知
- reactNative中的导航页面
- ReactNative学习六-Flex布局
- ReactNative学习十一-手写Item布局
- ReactNative初学笔记1.1flexbox布局
- 526. Beautiful Arrangement 回溯法
- dispatch_queue_concurrent
- java验证身份证号码
- SQL注入整合
- 在Android Studio 运行的时候报dalvikvm: Could not find class 'xxx',
- ReactNative中的布局
- Struts2
- Horizontal_ViewPager_Fragment
- C语言 剧情版小游戏
- 矩阵的最小路径和
- PHP 练习题
- 大津算法
- 基于RocketMQ的推送猜想
- javascript继承