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. python实现文件下载的方法总结

    前端时间遇到一个通过url下载文件的需求,只需要简单的编写一个py脚本即可.从网上搜了下python实现文件下载的方法,总结如下,备查. 以下方法均已测试,环境win8.1  python2.6/2. ...

  2. 数据库与vs的连接

    新建一个MFC基于对话框的项目后,更改属性, 其中需要将include(里面都是MySQL的头文件)lib是库文件,将.dll放入与.exe同级目录下,或放入系统里(c:\windows\system ...

  3. DLL卸载

    [DLL卸载] 1.扫描Module.通过CreateToohelp32Snapshot.Module32First.Module32Next来完成. 2.通过FreeLibrary来卸载.通过在ke ...

  4. 【bzoj1017】[JSOI2008]魔兽地图DotR

    1017: [JSOI2008]魔兽地图DotR Time Limit: 30 Sec  Memory Limit: 162 MBSubmit: 1658  Solved: 755[Submit][S ...

  5. libevent源码深度剖析七

    libevent源码深度剖析七 ——事件主循环 张亮 现在我们已经初步了解了libevent的Reactor组件——event_base和事件管理框架,接下来就是libevent事件处理的中心部分 — ...

  6. selenium2 用testNG对百度首页输入框进行测试 (三)

    如果还没有安装testNG的亲,可以点击http://www.cnblogs.com/milanmi/p/4346580.html查看安装过程. 这节主要是对百度首页的输入框进行输入测试. packa ...

  7. pandas map, apply, applymap区别

    map只对一个序列而言的. apply只是整个dataframe上任意一列或多列,或者一行或多行, 即可在任意轴操作. 在一列使用apply时,跟map效果一样. 多列时只能用apply. apply ...

  8. R语言读取MySQL数据表

    1.R中安装RODBC包 install.packages("RODBC") 2.在Windows系统下安装MySQL的ODBC驱动 注意区分32位和64位版本: http://d ...

  9. Entity Framework 6.0 Tutorials(3):Code-based Configuration

    Code-based Configuration: Entity Framework 6 has introduced code based configuration. Now, you can c ...

  10. requests基础

    爬虫的基本原理:爬虫本质上是模拟人浏览信息的过程,只不过他通过计算机来达到快速抓取筛选信息的目的.所以我们想要写一个爬虫,最基本的就是要将我们需要抓取信息的网页原原本本的抓取下来.这个时候就要用到re ...