StyleSheet.create()方法
//定义组件
var App = React.createClass({
render:function () {
return(
<View style={styles.container}>
/*拼接样式,使用数组的方式,使用多个样式 */
<View style={[styles.top,styles.border]}>
</View>
/*单独增加一个样式对象,在数组中追加{} */
<View style={[styles.bottom,styles.border,{borderWidth:5}]}>
</View> </View>
);
} }); /* 样式 与 h5 的区别:
* 1.h5中,以 ; 分号结尾
* RN中,以 , 逗号结尾
* 2.h5中,value如果是数字,需要带单位
* RN中,不需要单位
* 3.h5中,key value 都不加引号
* RN中,属于javaScript对象,key的名字不能出现'-',需要驼峰命名,如果value为字符串,需要加引号
*
* */ //定义样式
var styles = StyleSheet.create({
//外层view
container:{
marginTop:25,//驼峰规则,不能使用-分隔
marginLeft:30,
backgroundColor:"red",
width:300,
height:400
},
//上层view
top:{
backgroundColor:"green",
width:280,
height:250,
margin:10, },
//下层view
bottom:{
backgroundColor:"yellow",
width:280,
height:110,
margin:10, },
//公共样式
border:{
borderWidth:3,
borderColor:"black"
} });

StyleSheet的更多相关文章

  1. Qt StyleSheet皮肤css源码

    使用方式如下 //设置皮肤样式 static void SetStyle(const QString &styleName) { QFile file(QString(":/imag ...

  2. 浏览器默认样式(user agent stylesheet)+cssreset

    每种浏览器都有一套默认的样式表,即user agent stylesheet,在写网页时,没有指定的样式,按浏览器内置的样式表来渲染.这是合理的,像word中也有一些预留样式,可以让我们的排版更美观整 ...

  3. How To Create an IE-Only Stylesheet

    https://css-tricks.com/how-to-create-an-ie-only-stylesheet/ https://css-tricks.com/snippets/css/css- ...

  4. Add a stylesheet link programmatically in ASP.NET

    Here’s a code snippet used to programmatically insert a stylesheet link to an external CSS file: // ...

  5. rel="stylesheet" 描述

    <link type="text/css" rel="stylesheet" href="css/style.css"/> re ...

  6. 设置field的背景颜色以及对stylesheet的理解

    今天遇到一个需求:在做页面输入验证的时候,如果用户没有输入某个项,那么这个项显示为红色,一直没头绪,也找peoplebook,发现field有一个style的方法,后来又在谷歌上找,终于找到了方法: ...

  7. Qt QGroupBox StyleSheet 边框设置

    /**************************************************************************** * Qt QGroupBox StyleSh ...

  8. 利用link标签rel="alternate stylesheet"属性实现界面动态换肤

    rel="stylesheet"属性指定将一个样式表立即应用到文档.rel="alternate stylesheet"属性将其作为备用样式表而在默认情况下禁用 ...

  9. 可否控制<link type=text/css rel=stylesheet href=style.css>

    本篇文章主要介绍了"可否控制<link type=text/css rel=stylesheet href=style.css> ", 主要涉及到可否控制<lin ...

  10. odoo 错误 Resource interpreted as Stylesheet but transferred with MIME type application/x-css:

    odoo8   页面内容显示一半,  web 控制台显示错误  Resource interpreted as Stylesheet but transferred with MIME type ap ...

随机推荐

  1. JAVA基础知识总结17(网络编程)

    端口: 物理端口:IP地址 逻辑端口:用于标识进程的逻辑地址,不同进程的标识:有效端口:0~65535,其中0~1024系统使用或保留端口. JAVA中ip对象:InetAddress. import ...

  2. java Web中页面跳转方式之请求转发

    1.在一个请求中跨越多个Servlet 2.多个Servlet在一个请求中,他们共享request对象.就是在Servlet01中setAttribute()保存数据在Servlet02中由getAt ...

  3. 724. Find Pivot Index 找到中轴下标

    [抄题]: Given an array of integers nums, write a method that returns the "pivot" index of th ...

  4. 一个可用模板的Xml描述

    <?xml version="1.0" encoding="utf-8"?> <VMTEMPLATE> <ID>48< ...

  5. Luogu 4091 [HEOI2016/TJOI2016]求和

    BZOJ 4555 一道模板题. 第二类斯特林数有公式: $$S(n, m) = \frac{1}{m!}\sum_{i = 0}^{m}(-1)^i\binom{m}{i}(m - i)^n$$ 考 ...

  6. 6.Dump域内用户Hash姿势集合

    本文转自先知社区,原文链接:https://xz.aliyun.com/t/2527#toc-10 原文地址:https://pentestlab.blog/2018/07/04/dumping-do ...

  7. 实践作业3:白盒测试---细化明确任务DAY5

    收到老师给我写的评论,感觉老师真的太认真,每个博客都有仔细的,参考了老师发给我的博客,我才明白老师想要的博客内容原来是具体实际的进展记录.我们组其实这些东西早就确定了,会议也开了,但是我之前不明白博客 ...

  8. 二度Xml<2>

    一下介绍xml的基本操作,添加xml新节点: 其他方法在前一篇日记中有详细讲解,请详见:http://www.cnblogs.com/fjsnail/archive/2012/10/20/273212 ...

  9. URAL 1141. RSA Attack(欧拉定理+扩展欧几里得+快速幂模)

    题目链接 题意 : 给你n,e,c,并且知道me ≡ c (mod n),而且n = p*q,pq都为素数. 思路 : 这道题的确与题目名字很相符,是个RSA算法,目前地球上最重要的加密算法.RSA算 ...

  10. (转)mongodb学习(翻译1)

    原文地址:http://www.cnblogs.com/Johnzhang/archive/2013/09/10/3313582.html 学习mongodb,试着翻译写,英语能力有限,希望大家指正, ...