当前位置: 首页 > 软件库 > 手机/移动开发 > >

nativescript-gradient

授权协议 View license
开发语言 JavaScript TypeScript
所属分类 手机/移动开发
软件类型 开源软件
地区 不详
投 递 者 支阳波
操作系统 iOS
开源组织
适用人群 未知
 软件概览

DEPRECATED: a cross platform, no dependency plugin is available here

NativeScript-Gradient

NativeScript plugin to provide gradient layouts. Gradient support is available in NativeScript usingCSS but I really like the declarative API of this plugin so I'm going to share ��

Samples

Screen 1 Screen 2

Native Libraries:

Android iOS
csdodd/GradientLayout Evaluating native iOS libs...

Installation

From your command prompt/termial go to your app's root folder and execute:

tns plugin add nativescript-gradient

Usage

XML:

<Page 
  xmlns="http://schemas.nativescript.org/tns.xsd" 
  xmlns:Gradient="nativescript-gradient" loaded="pageLoaded">
  <ActionBar title="Gradients" />
  <StackLayout height="100%">
    <Gradient:Gradient height="50%" startColor="#DA22FF" endColor="#9733EE" orientation="LEFT_RIGHT" id="gradient">
      <StackLayout>
        <Label text="Left to Right" class="info" textWrap="true" />
        <Image src="~/images/wonka.jpg" stretch="aspectFit" />
      </StackLayout>
    </Gradient:Gradient>
    <Gradient:Gradient height="50%" startColor="#c2e59c" endColor="#64b3f4" orientation="TL_BR">
      <StackLayout>
        <Label text="Top Left to Bottom Right" class="info" textWrap="true" />
        <Button text="WHATEVER YOU LIKE" tap="gotoMain" height="50" />
      </StackLayout>
    </Gradient:Gradient>
  </StackLayout>
</Page>

Attributes

startColor - (color string) - required

Attribute to set the starting color of the gradient.

endColor - (color string) - required

Attribute to set the ending color of the gradient.

orientation - (string) - optional --- Default is Top to bottom direction.

Android Orientation Options

These values determine the starting and end of the gradient.

  • BL_TR (Bottom Left to Top Right)
  • BOTTOM_TOP (Bottom to Top)
  • BR_TL (Bottom Right to Top Left)
  • LEFT_RIGHT (Left to Right)
  • RIGHT_LEFT (Rigth to Left)
  • TL_BR (Top Left to Bottom Right)
  • TOP_BOTTOM (Top to Bottom) default if not specified
  • TR_BL (Top Right to Bottom Left)
  • tensorflow 自动求导 官方API x = tf.constant(3.0) with tf.GradientTape() as g: g.watch(x) y = x * x dy_dx = g.gradient(y, x) # Will compute to 6.0 上面是是对方程 y = x 2 y=x^2 y=x2的一阶求导,即 ( y ′ = 2 x ∣ x = 3.0

  • 今天手机升级成Android10.0系统,在开发项目中突然发现渐变样式方向错了,shape中gradient的默认方向是从左到右,也就是android:angle=“0”,但是由于人懒,就没写android:angle=“0”,运行项目后发现渐变方向是从上往下,而非默认的从左到右! 如果没设置angle方向的,记得加上就能解决了。 不知道是不是手机厂家UI系统的问题,我的是MIUI11出现的问题,

  • 来讲个故事吧,这是我一个朋友最近遇到的一件事情,需求UI稿中有需要为一个视图设置渐变的背景颜色,然后我的这个朋友就屁颠屁颠地去根据UI稿去实现了。与渐变相关的实现如下,仅仅需要设置渐变开始颜色和结束颜色,其余都采用默认值即可。 <gradient android:startColor="@color/..." android:endColor="@color/..." /> 然后流

 相关资料
  • NativeScript 可以使用 Javascript,CSS, XML 创建真正的 Native 跨平台应用,支持 iOS Android,NativeScript 将您的跨平台代码翻译成目标平台的代码。 UI 使用 XML 描述,CSS 样式,在编译时将 UI 转化成本地原生代码,最终得到正在的 Native 原生应用。 Telerik 公开了用于创建安卓、iOS和Windows Unive

  • NativeScript Command-Line Interface The NativeScript CLI lets you create, build, and deploy NativeScript-based apps on iOS and Android devices. Get it using: npm install -g nativescript What is Native

  • NativeScript-Snackbar �� �� �� NativeScript plugin for Material Design SnackBar component. Installation: NativeScript 7+:tns plugin add @nstudio/nativescript-snackbar NativeScript version prior to 7:t

  • Nativescript-Ripple This plugin aims to bring a native (or close to native) ripple implementation on Android and iOS. The android version uses a RippleDrawable and conserves the previous background, a

  • NativeScript-FloatingActionButton NativeScript plugin for Material Design Floating Action Button UI component. Installation Nativescript 7+: ns plugin add @nstudio/nativescript-floatingactionbutton Na

  • NativeScript CardView A NativeScript plugin to provide an XML widget to implement the Material Design CardView component. Installation NativeScript 7+: ns plugin add @nstudio/nativescript-cardview Nat