分享更有价值
被信任是一种快乐

react native如何设置页面背景色

文章页正文上

这篇文章主要讲解了“react native如何设置页面背景色”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“react native如何设置页面背景色”吧! react native设置页面背景色的方法:1、通过“yarn add react-native-linear-gradient”安装免费云主机、域名“react-native-linear-gradient”组件;2、通过在页面设置“React-Native使用渐变背景色在 CSS 中使用渐变只需要用 linear-gradient 就可以,但是在 React-Native 项目中却不可以直接通过属性去实现,需要安装一个 react-native-linear-gradient 才可实现。首先安装组件 react-native-linear-gradient在页面中使用
效果:LinearGradient的属性:colors
An array of at least two color values that represent gradient colors. Example: [‘red’, ‘blue’] sets gradient from red to blue.
至少2个颜色值,用于颜色渐变。start
An optional object of the following type: { x: number, y: number }. Coordinates declare the position that the gradient starts at, as a fraction of the overall size of the gradient, starting from the top left corner. Example: { x: 0.1, y: 0.1 } means that the gradient will start 10% from the top and 10% from the left.
可选的对象,形式如: { x: number, y: number }。坐标宣告了渐变的开始位置。end
Same as start, but for the end of the gradient.
和start一样,但是渐变的结束位置。
start和end同时存在,渐变的起点和终点的连线,即使渐变的轨迹方向。
start={{ x : 0.0, y : 0.25 }}end={{ x : 0.5, y : 1.0 }}locations
An optional array of numbers defining the location of each gradient color stop, mapping to the color with the same index in colors prop. Example: [0.1, 0.75, 1] means that first color will take 0% – 10%, second color will take 10% – 75% and finally third color will occupy 75% – 100%.
可选数组,内容是一些列数字,定义了colors中对应的每个渐变颜色的停止位置。0.1-0.7 是颜色1和颜色2之间渐变的区域,0.7到1是颜色2和颜色3之间渐变的区域。那么还有个0-0.1区域呢?该区域是颜色1。
locations={[ 0, 0.5, 0.8]},则0-0.5是颜色1和颜色2渐变区域,0.5-0.8是颜色2和颜色3的渐变区域,而0.8-1区域的颜色是颜色3。设置旋转角度感谢各位的阅读,以上就是“react native如何设置页面背景色”的内容了,经过本文的学习后,相信大家对react native如何设置页面背景色这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是云技术,小编将为大家推送更多相关知识点的文章,欢迎关注!

相关推荐: vue条件渲染指令有哪些

这篇文章主要介绍“vue条件渲染指令有哪些”,在日常操作中,相信很多人在vue条件渲染指令有哪些问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”vue条件渲染指令有哪些”的疑惑有所帮助!接下来,请跟着小编一起来学习吧! vue条件…

文章页内容下
赞(0) 打赏
版权声明:本站采用知识共享、学习交流,不允许用于商业用途;文章由发布者自行承担一切责任,与本站无关。
文章页正文下
文章页评论上

云服务器、web空间可免费试用

宝塔面板主机、支持php,mysql等,SSL部署;安全高速企业专供99.999%稳定,另有高防主机、不限制内容等类型,具体可咨询QQ:360163164,Tel同微信:18905205712

主机选购导航云服务器试用

登录

找回密码

注册