NativeScript Material ShowcaseView
基于 MaterialShowcaseView 库的 Android 原生脚本插件 https://github.com/deano2390/MaterialShowcaseView。
npm i --save nativescript-material-showcaseview
- 版本:1.0.1
- GitHub: https://github.com/rcluan/nativescript-material-showcaseview
- NPM: https://npmjs.net.cn/package/nativescript-material-showcaseview
- 下载
- 昨天: 0
- 上周: 0
- 上个月: 0
NativeScript Material ShowcaseView
Nativescript 的 Material 设计主题展示视图(教练标记)。
此插件仅适用于 Android 设备,它基于 * MaterialShowcaseView。如果您正在寻找 iOS 版本,请考虑检查 * nativescript-coachmarks。
入门
要安装,请运行 npm install nativescript-material-showcaseview
用法
将 NSMaterialShowcaseView
类导入您的模块,然后创建其新实例。
import { NSMaterialShowcaseView } from 'nativescript-material-showcaseview'
export class MyModel {
private showcaseView: NSMaterialShowcaseView;
constructor() { this.showcaseView = new NSMaterialShowcaseView(); }
}
IShowcaseItem 和 IShowcaseConfig 接口分别代表展示项和展示配置。
export interface IShowcaseItem {
target: any; // the element in your view (e.g a button)
dismissText: string; // the text to dismiss the show case
contentText: string; // the text explaining the element
withRectangleShape: boolean;
}
项目示例
let item : IShowcaseItem = {
target: this.btn,
dismissText: "GOT IT",
contentText: "This is the start button",
withRectangleShape: false
};
当前该插件仅实现了 MaterialShowcaseView 上可用的展示序列。要创建序列,您应调用 this.showcaseView.createSequence(items)
,其中参数 items 代表 IShowcaseItem 数组。
注意:如果您只想突出显示视图中的一个元素,则您的数组必须只有一个元素。
this.showcaseView.startSequence()
启动展示序列,而 this.showcaseView.reset()
重置序列,以便可以再次显示。
如果您需要查看一个工作示例,这里有一个示例应用程序。