nativescript-android-toast
Nativescript Android 设备的 Toast 插件
npm i --save nativescript-android-toast

Nativescript Android Toast

npm GitHub Build Status npm GitHub issues Status Twitter Follow

安装

tns plugin add nativescript-android-toast


API (方法)

MakeToast(text : String, duration : "long" or "short");

API (属性)

属性 类型 必需 描述
text 字符串 必需 您想要显示的文本
duration 字符串 可选 "long" 或 "short" 显示时长

演示

演示 1 演示 2
Demo 1 Demo 2

用法

TypeScript

import Toast from "nativescript-android-toast";

showToast() {
Toast.MakeToast("Hello Typescript","short");
}

<Button text="click" (tap)="showToast();">

JavaScript

var Toast = require("nativescript-android-toast");

showToast() {
Toast.MakeToast("Hello Javascript","long");
}

https://developer.android.com.cn/reference/android/widget/Toast