npm i --save nativescript-tooltip
- 版本:2.1.2
- GitHub: https://github.com/triniwiz/nativescript-tooltip
- NPM: https://npmjs.net.cn/package/nativescript-tooltip
- 下载量
- 昨天: 0
- 上周: 16
- 上个月: 91
NativeScript 工具提示
安装
tns plugin add nativescript-tooltip
使用方法
TypeScript
import {ToolTip} from "nativescript-tooltip";
const tip = new ToolTip(view,{text:"Some Text"});
tip.show(); //.hide()
JavaScript
const ToolTip = require("nativescript-tooltip").ToolTip;
const tip = new ToolTip(view,{text:"Some Text"});
tip.show(); //.hide()
样式
Android
将以下内容添加到您的 app/App_Resources/Android/values/styles.xml
文件中
<!-- Custom ToolTip -->
<style name="CustomToolTipLayoutStyle" parent="ToolTipLayoutDefaultStyle">
<item name="ttlm_backgroundColor">#FFFF00</item>
<item name="android:textColor">#000000</item>
</style>
IOS
TypeScript
import {ToolTip} from "nativescript-tooltip";
const tip = new ToolTip(view,{text:"Some Text",backgroundColor:"pink",textColor:"black"});
tip.show(); //.hide()
JavaScript
const ToolTip = require("nativescript-tooltip").ToolTip;
const tip = new ToolTip(view,{text:"Some Text",backgroundColor:"pink",textColor:"black"});
tip.show(); //.hide()
配置
const config = {
position?: "left" | "up" | "right" | "down" | "top" | "bottom";;
text: string;
viewType?: "native";
duration?: number;
fadeDuration?: number,
width?: number;
delay?: number;
hideArrow?: boolean;
backgroundColor?: string;
textColor?: string;
style?:string;
}
屏幕截图
Android | IOS |
---|---|