Extension

« Back to index

Extension

Table of Contents:

AI2Utils

Component for AI2Utils

Properties

None

Events

None

Methods

FindContactsByName(name,fuzzyMatch)
通过姓名查找通讯录,返回 (联系人,手机号) 的列表。fuzzyMatch:是否模糊匹配
FindContactsByNumber(number,fuzzyMatch)
通过手机号查找通讯录,返回 (联系人,手机号) 的列表。fuzzyMatch:是否模糊匹配
GoHome()
返回手机桌面。
IsFirstRun()
判断App是否是第一次运行,如果是则返回’真’,否则返回’假’。
ResetFirstRun()
重置App的运行状态为第一次运行。
SystemSettings()
跳转到系统设置界面
WirelessSettings()
跳转到无线和网络设置界面

AirPlaneState

Component for AirPlaneState

Properties

None

Events

AirPlaneState(state)
反馈飞行模式状态,参数值为:开启、关闭

Methods

GetAirPlaneState()
获取飞行模式状态,返回值为:开启、关闭

AliSms

Component for AliSms

Properties

AccessKeyId
AccessKey ID
AccessKeySecret
AccessKey Secret

Events

None

Methods

RandomNumCode(length)
返回一个指定位数随机数字码。
SendSms(phoneNumber,signName,templateCode,templateParam)
发送短信。参数:手机号,签名名称,模板CODE,模板参数JSON

BaiduPan

Component for BaiduPan

Properties

AccessToken
当前使用的 access_token。
AppId
百度开放平台应用的 AppID。
AppKey
百度开放平台应用的 AppKey。
DefaultScope
授权时默认申请的 scope。默认值是 basic,netdisk。
UserAgent
HTTP 请求默认使用的 User-Agent。

Events

AccessTokenChanged(token)
当 AccessToken 属性通过解析授权回调被更新时触发。
ApiError(operation,httpStatus,message,responseBody)
接口调用失败时触发。
DownloadLinkReceived(fsId,dlink,json)
获取下载链接成功时触发。
DownloadSuccess(savePath,bytesWritten)
下载文件成功时触发。
FileMetasReceived(json)
获取文件信息成功时触发。
FilesListed(dir,json)
获取文件列表成功时触发。
UploadProgress(remotePath,uploadedParts,totalParts)
上传分片进度更新时触发。
UploadSuccess(remotePath,json)
上传文件成功时触发。

Methods

AuthorizationUrl()
生成百度网盘授权地址,默认使用当前 AppKey 和 DefaultScope。
AuthorizationUrlWithScope(scope)
生成百度网盘授权地址。scope 为空时使用 DefaultScope。
根据 dlink 直接下载文件到本地路径。
DownloadByFsId(fsId,savePath)
根据 fsId 直接下载文件到本地路径。
ExtractAccessToken(redirectUrl)
从授权回调 URL 中解析 access_token,并写回 AccessToken 属性。
ExtractExpiresIn(redirectUrl)
从授权回调 URL 中解析 expires_in。未找到时返回空字符串。
获取单个文件的 dlink。
GetFileMetas(fsIdsJson)
获取一个或多个文件的详细信息。fsIdsJson 例如:[1737895653506]。
ListFiles(dir)
获取目录下的文件列表,使用默认参数:按 time 排序,start=0,limit=100,desc=true。
ListFilesEx(dir,start,limit,order,desc,foldersOnly)
获取目录文件列表。foldersOnly 为真时仅列出目录。
UploadFile(remotePath,localFilePath,replaceMode)
上传文件到百度网盘。replaceMode: 0=冲突时报错, 1=路径冲突即重命名, 2=路径冲突且内容不同才重命名, 3=覆盖。

BrowserPromptHelper

Component for BrowserPromptHelper

Properties

None

Events

OnResume(url)
Event raised when app gets resumed and gives the url which started this activity/screen if there is any else empty string

Methods

GetStartUrl()
Returns the url which started the current activity

ClientSocketAI2Ext

TCP Socket 客户端扩展。

  • 该组件用于主动连接远程 Socket 服务端,并提供文本或二进制数据的发送能力。 连接建立后会在后台线程持续监听服务端返回的数据,再通过事件把结果切回主线程抛给积木层。

  • 原作者与历史维护信息保留如下:

Properties

ConnectionState
返回当前连接状态。
  • 返回 true 表示当前 Socket 已建立连接; 返回 false 表示未连接、正在断开,或连接已关闭。
HexaStringMode
设置发送和接收数据时使用的模式。
  • 关闭时,字符串按 UTF-8 文本直接收发; 开启时,发送内容会按十六进制文本转为字节,接收内容也会转为十六进制字符串返回。
SeqNewLine
返回仅包含换行的控制字符串 "\n"。
SeqNewLineAndRet
返回包含换行加回车的控制字符串 "\n\r"。
  • 可用于某些需要特定结束符的协议拼接。
SeqRet
返回仅包含回车的控制字符串 "\r"。
SeqRetAndNewLine
返回包含回车加换行的控制字符串 "\r\n"。
  • 这是很多文本协议中常见的行结束符。
ServerAddress
设置要连接的服务器地址。
  • 通常填写 IP 地址或域名,例如 192.168.1.10 或 example.com。
ServerPort
设置要连接的服务器端口。
  • 例如 80、443、9000 等。
TimeoutMs
服务器连接超时时间(毫秒)

Events

ConnectFailed(message)
当异步连接失败时触发。
  • 该事件通常表示主机不可达、端口错误、超时,或地址格式不正确。
Connected()
当异步连接成功建立后触发。
  • 建议在该事件中开始发送数据,而不是在调用 Connect() 后立即发送。
DataReceived(data)
当接收到服务器发来的数据时触发。
  • 返回内容会根据当前模式决定: 普通模式下返回 UTF-8 文本; 十六进制模式下返回十六进制字符串。
Disconnected()
当本地主动断开连接并完成资源释放后触发。
  • 该事件仅表示本地主动调用 Disconnect() 后的完成通知, 不代表远端主动断开。
FileSendFailed(fileName,message)
文件发送失败时触发。
  • 未连接、文件不存在、连接中断等任何失败都会触发本事件, message 参数给出具体原因(同时也会通过错误弹窗提示)。
FileSendProgress(fileName,bytesSent,totalBytes)
文件发送过程中周期性触发。
  • 按完成百分比推进(最多约 100 次),可在该事件中更新进度条或标签文字。
FileSent(fileName,bytesSent)
文件全部发送完成后触发。
  • 推荐配合 GetFileSize 组成”先发长度行、再发文件”的协议(见下方示例)。 不要靠扫描文件内容里的特殊字节判断结束——二进制文件中任何字节都可能出现。

  • 需要继续发送下一段内容的协议,可以在本事件中继续调用 SendData 或下一个 SendFile。

RemoteConnectionClosed()
当远端主动关闭连接,或接收线程检测到连接被远端中断时触发。
  • 该事件用于区分“本地主动断开”和“服务端或网络导致连接中断”这两种情况。

Methods

Connect()
异步发起连接,并在连接成功后启动后台接收线程。
  • 本方法调用后会立即返回,不会阻塞界面线程。 真正连接成功时会触发 Connected 事件; 连接失败时会触发 ConnectFailed 事件,同时也会抛出错误事件。

  • 如果当前已经连接,或者仍处于连接进行中,则本次调用会直接报错并返回。

Disconnect()
异步断开与服务器的连接。
  • 本方法会在后台线程关闭输入流和 Socket 本身,并在完成后触发 Disconnected 事件。 如果当前并未连接,或者已经处于断开过程中,则会直接报错并返回。
GetFileSize(fileName)
返回文件的总字节数,文件名写法与 SendFile 完全相同。
  • 返回 0 表示文件存在但为空;返回 -1 表示文件不存在(同时弹出错误提示)。

  • 主流用法:发送文件前先 SendData 把长度发给服务器(如 join(GetFileSize("//logo.png"), SeqNewLine)),紧接 SendFile—— 接收端先读一行长度、再精确接收 N 个字节,文件内容里出现任何字节都不会被误认为边界, 传输二进制文件(图片、音频等)也安全。这也是 HTTP Content-Length、 WebSocket 帧等主流协议采用的方式。

SendBinaryData(listBytes)
以字节列表的形式向服务器发送二进制数据。
  • 参数应为由数字组成的列表,每个数字都会按一个字节写入 Socket 输出流。 适合需要发送原始二进制协议帧的场景。
SendData(data)
以文本方式向服务器发送数据。
  • 当十六进制模式关闭时,参数会按普通文本原样发送; 当十六进制模式开启时,参数必须是合法的十六进制字符串,并会先转成字节再发送。

  • 真正的发送动作在后台线程执行,因此不会阻塞界面线程。

SendFile(fileName)
把整个文件按原始字节直接发送到服务器。
  • 文本文件、图片、音频等任意类型的文件都可以发送:内容按 64KB 分块从文件流写入 Socket, 不做任何文本或十六进制转换,因此与 HexaStringMode 的设置无关, 二进制文件也能逐字节原样到达对端。大文件不会一次性读入内存。

  • 文件名的三种写法: 以 // 开头表示工程素材(如 //logo.png); 绝对路径原样使用(如相机返回的 /storage/emulated/0/Pictures/xx.jpg); 相对文件名会依次在应用外部私有目录、内部目录、缓存目录中查找, 都找不到时再按素材名尝试——Web 组件勾选保存响应、File 组件下载的文件可直接用文件名。

  • 发送在后台线程执行。过程中周期性触发 FileSendProgress(最多约 100 次), 全部写出后触发 FileSent。本方法只写文件内容、不加任何帧, 推荐配合 GetFileSize 组成”先发长度行、再发文件”的协议(见下方示例)。 未连接、文件不存在、连接中断等任何失败都会触发 FileSendFailed。 同一时刻只允许一个文件在发送,上一个文件结束(成功或失败)后再发下一个。

发送文件示例

连接成功后先发一行文件长度、再发文件本体(接收端先读长度行,再精确接收 N 个字节, 文件内容里出现任何字节都不会被误认为边界,二进制文件也安全):

when ClientSocketAI2Ext1.Connected() {
    ClientSocketAI2Ext1.SendData(join(ClientSocketAI2Ext1.GetFileSize("//cat.png"), ClientSocketAI2Ext1.SeqNewLine))
    ClientSocketAI2Ext1.SendFile("//cat.png")
}
when ClientSocketAI2Ext1.FileSendProgress(文件名, 已发送字节数, 总字节数) {
    标签_状态.Text = join("发送中 ", 已发送字节数, " / ", 总字节数, " 字节")
}
when ClientSocketAI2Ext1.FileSent(文件名, 已发送字节数) {
    标签_状态.Text = join("已发送 ", 已发送字节数, " 字节")
}
when ClientSocketAI2Ext1.FileSendFailed(文件名, 消息) {
    标签_状态.Text = join("发送失败:", 消息)
}

Clipboard

Component for Clipboard

Properties

SuppressToast
Specifies whether Success Toast should be suppressed

Events

None

Methods

Copy(text)
The Copy method http://stackoverflow.com/a/19253877/1545993 and http://stackoverflow.com/a/28780585/1545993
Paste()
The Paste method http://stackoverflow.com/a/19253877/1545993

CloudBaseAuth

腾讯CloudBase身份认证扩展,完整覆盖登录注册、验证码、Token管理和用户管理接口。API文档

登录、注册或刷新成功后,直接读取 AccessToken、RefreshToken、UserId 属性。结果异步返回,请处理成功事件和 RequestFailed;验证码发送、校验的数据分别从对应完成事件读取。

属性

AccessToken
访问令牌,登录成功后自动存储。跨页面使用时可读取此属性传递给其他组件
EnvironmentId
CloudBase环境ID
RefreshToken
刷新令牌,登录成功后自动存储
Region
服务器地域
超时时间(毫秒)
HTTP请求超时时间(毫秒)
用户账号
用户ID,登录成功后自动存储

事件

AnonymousSignInSuccess()
匿名登录成功。AccessToken已自动存储
CaptchaDataSuccess(响应代码,数据)
图片验证码获取成功。responseCode: HTTP响应码, data: 包含data(图片base64)、token(用于VerifyCaptchaData)、expires_in(过期秒数)
CaptchaVerified(响应代码,数据)
图片验证码校验成功。responseCode: HTTP响应码, data: 包含captcha_token(用于SendVerificationCode)、expires_in(过期秒数)
CurrentUserSuccess(响应代码,数据)
获取当前用户成功。responseCode: HTTP响应码, data: 当前用户信息JSON
DeleteAccountSuccess(响应代码,数据)
注销用户成功。responseCode: HTTP响应码, data: 接口返回结果
RefreshTokenSuccess()
刷新Token成功。AccessToken/RefreshToken已自动更新
RequestFailed(操作,错误代码,错误信息)
请求失败。operation: 操作名称, errorCode: 错误码, errorMessage: 错误信息
ResetPasswordSuccess(响应代码,数据)
重置密码成功。responseCode: HTTP响应码, data: 接口返回结果
SignInSuccess()
登录成功。AccessToken/RefreshToken/UserId已自动存储
SignOutSuccess(响应代码,数据)
退出登录成功。responseCode: HTTP响应码, data: 接口返回结果
SignUpSuccess()
注册成功。AccessToken/RefreshToken/UserId已自动存储
UpdatePasswordSuccess(响应代码,数据)
修改密码成功。responseCode: HTTP响应码, data: 接口返回结果
UpdateUserInfoSuccess(响应代码,数据)
修改用户信息成功。responseCode: HTTP响应码, data: 接口返回结果
ValidateTokenSuccess(响应代码,数据)
Token校验成功。responseCode: HTTP响应码, data: 包含token_type、client_id、sub等token信息
VerificationCodeSent(响应代码,数据)
验证码发送成功。responseCode: HTTP响应码, data: 包含verification_id等信息
VerificationCodeVerified(响应代码,数据)
验证码校验成功。responseCode: HTTP响应码, data: 包含verification_token等信息

方法

DeleteAccount()
注销当前用户(永久删除账号,不可恢复,需已登录)
GetCaptchaData()
获取图片验证码。返回包含base64图片(Picture属性可直接显示)、token(用于VerifyCaptchaData)和过期时间
GetCurrentUser()
获取当前登录用户信息
RefreshAccessToken()
用上次登录保存的RefreshToken刷新AccessToken
ResetPassword(邮箱,电话号码,newPassword,verificationToken)
重置密码。email和phoneNumber二选一,phoneNumber格式为”国家代码 空格 手机号”(如+86 13000000000,注意+86和号码之间必须有空格),verificationToken来自验证码校验接口
SendVerificationCode(邮箱,电话号码,captchaToken)
发送邮箱或短信验证码。email和phoneNumber二选一,phoneNumber格式为”国家代码 空格 手机号”(如+86 13000000000,注意+86和号码之间必须有空格),captchaToken为VerifyCaptchaData返回的captcha_token(可为空表示不需要图片验证)
SignInAnonymously()
匿名登录
SignInWithPassword(username,password)
用户登录(用户名/密码)。username: 用户名, password: 密码
SignInWithVerification(verificationToken)
用户登录(验证码)。verificationToken: 验证码token
SignOut()
退出当前登录
SignUpWithEmail(email,verificationToken,username,password)
用户注册(邮箱)。email: 邮箱, verificationToken: 验证码token, username: 用户名(可选), password: 密码(可选)
SignUpWithPhone(电话号码,verificationToken,username,密码)
用户注册(手机号)。phoneNumber: 手机号,格式为”国家代码 空格 手机号”(如+86 13000000000,注意+86和号码之间必须有空格), verificationToken: 验证码token, username: 用户名(可选), password: 密码(可选)
UpdatePassword(oldPassword,newPassword)
修改密码(需已登录)。oldPassword: 旧密码, newPassword: 新密码(8-64位)
UpdateUserInfo(nickname,username,avatarUrl)
修改用户信息(需已登录)。nickname/username/avatarUrl都可为空表示不修改
ValidateToken()
检查当前AccessToken是否有效(需已登录)。成功返回token信息,失败表示token已过期
VerifyCaptchaData(captchaToken,userInput)
校验图片验证码。captchaToken为GetCaptchaData返回的token,userInput为用户看到图片后输入的验证码文本。成功后返回captcha_token用于SendVerificationCode
VerifyVerificationCode(verificationId,verificationCode)
验证邮箱或短信验证码。verificationId: 发送接口返回的ID, verificationCode: 用户输入的验证码

CloudBaseDatabase

Component for CloudBaseDatabase

Properties

AccessToken
AccessToken
ClientId
应用ClientId,为空时默认使用环境ID
DefaultCollection
默认集合名。设置后可直接调用 AddData/GetData 等更短的快捷方法
DefaultFunctionName
默认数据库代理云函数名。设置后可直接调用 AddDoc/GetDocs 等快捷方法
EnvironmentId
CloudBase环境ID
Region
服务器地域:domestic(国内)或international(海外)
Timeout
HTTP请求超时时间(毫秒)

Events

OperationSuccess(responseCode,data)
数据库操作成功。responseCode: HTTP响应码, data: 返回的数据
RequestFailed(operation,errorCode,errorMessage)
请求失败。operation: 操作名称, errorCode: 错误码, errorMessage: 错误信息

Methods

Add(functionName,collection,data)
新增文档。functionName: 云函数名称, collection: 集合名, data: JSON对象或数组
AddData(data)
新增文档。使用 DefaultFunctionName 和 DefaultCollection
AddDoc(collection,data)
新增文档。使用 DefaultFunctionName
Count(functionName,collection,data)
统计文档数量。functionName: 云函数名称, collection: 集合名, data: JSON查询条件
CountData(data)
统计文档数量。使用 DefaultFunctionName 和 DefaultCollection
CountDocs(collection,data)
统计文档数量。使用 DefaultFunctionName
DatabaseOperation(functionName,operation,collection,data)
通过云函数操作文档型数据库。functionName为空时会回退到 DefaultFunctionName,operation: add/get/update/remove/count
Get(functionName,collection,data)
查询文档。functionName: 云函数名称, collection: 集合名, data: JSON查询条件
GetData(data)
查询文档。使用 DefaultFunctionName 和 DefaultCollection
GetDocs(collection,data)
查询文档。使用 DefaultFunctionName
GetJsonValue(jsonText,path)
从JSON字符串中提取字段。path支持点号路径和数组下标,例如 data.total 或 list.0._id
Remove(functionName,collection,data)
删除文档。functionName: 云函数名称, collection: 集合名, data: JSON删除条件
RemoveData(data)
删除文档。使用 DefaultFunctionName 和 DefaultCollection
RemoveDocs(collection,data)
删除文档。使用 DefaultFunctionName
Update(functionName,collection,data)
更新文档。functionName: 云函数名称, collection: 集合名, data: JSON更新参数
UpdateData(data)
更新文档。使用 DefaultFunctionName 和 DefaultCollection
UpdateDocs(collection,data)
更新文档。使用 DefaultFunctionName

CloudBaseFunction

调用云函数后,在 FunctionSuccess 中读取结果;失败时处理 RequestFailed。参数 params 为 JSON 文本。

Properties

AccessToken
访问令牌。设置CloudBaseAuth后自动获取;跨页面使用时需手动设置此属性。优先级:手动设置 > Auth引用
CloudBaseAuth
Auth组件引用,设置后自动获取环境ID和AccessToken。跨页面使用时改为手动设置EnvironmentId和AccessToken属性
EnvironmentId
Property for EnvironmentId
Region
Property for Region
超时时间(毫秒)
Property for Timeout

Events

FunctionSuccess(响应代码,数据)
云函数调用成功。responseCode: HTTP响应码, data: 函数返回的数据
RequestFailed(操作,错误代码,错误信息)
请求失败。operation: 操作名称, errorCode: 错误码, errorMessage: 错误信息

Methods

CallFunction(函数名称,params)
调用云函数。functionName: 函数名, params: JSON参数(可为空)

CloudBaseMySQL

查询、插入、更新和删除均通过对应的成功事件返回结果,失败时触发 RequestFailed;不要把方法调用当成同步返回值。

Properties

AccessToken
访问令牌。设置CloudBaseAuth后自动获取;跨页面使用时需手动设置此属性。优先级:手动设置 > Auth引用
CloudBaseAuth
Auth组件引用,设置后自动获取环境ID和AccessToken。跨页面使用时改为手动设置EnvironmentId和AccessToken属性
EnvironmentId
Property for EnvironmentId
Region
Property for Region
超时时间(毫秒)
Property for Timeout

Events

DeleteSuccess(响应代码,affectedRows)
删除成功。responseCode: HTTP响应码, affectedRows: 影响行数
InsertSuccess(响应代码,数据,affectedRows)
插入成功。responseCode: HTTP响应码, data: 插入后的数据, affectedRows: 影响行数
QuerySuccess(响应代码,数据,totalCount)
查询成功。responseCode: HTTP响应码, data: JSON结果, totalCount: 总记录数。接口未返回总数头时,会用返回数组长度兜底;select=count时读取count字段。
RequestFailed(操作,错误代码,错误信息)
请求失败。operation: 操作名称, errorCode: 错误码, errorMessage: 错误信息
UpdateSuccess(响应代码,数据,affectedRows)
更新成功。responseCode: HTTP响应码, data: 更新后的数据, affectedRows: 影响行数

Methods

Count(表名,where)
统计记录数量。table: 表名, where: WHERE条件(可为空)
删除(表名,where)
删除记录。table: 表名, where: WHERE条件(必须提供)
GetOne(表名,where,select,orderBy)
取第一条记录。table: 表名, where: WHERE条件, select: 字段列表, orderBy: 排序
插入(表名,数据)
插入记录。table: 表名, data: JSON数据
List(表名,limit)
获取整表前N条数据。table: 表名, limit: 返回数量,<=0时不限制
Query(表名,where,select,orderBy,limit,offset)
完整查询。table: 表名, where: WHERE条件, select: 选择字段, orderBy: 排序, limit: 限制数量, offset: 偏移量
QuerySimple(表名,where)
简单查询。table: 表名, where: WHERE条件(如 “name=eq.张三&age=gte.18”)
更新(表名,where,数据)
更新记录。table: 表名, where: WHERE条件(必须提供), data: 更新的JSON数据

CloudBaseStorage

腾讯CloudBase文件存储扩展,支持上传、下载、获取访问链接和删除文件。API文档

上传时传手机本地文件路径;下载时同时传云端路径和本地保存路径。上传结果从 UploadSuccess 的数据读取,下载完成事件给出云端路径、本地路径及写入字节数;获取临时访问链接调用 GetFileUrl。

属性

AccessToken
访问令牌。设置CloudBaseAuth后自动获取;跨页面使用时需手动设置此属性。优先级:手动设置 > Auth引用
CloudBaseAuth
Auth组件引用,设置后自动获取环境ID和AccessToken。跨页面使用时改为手动设置EnvironmentId和AccessToken属性
EnvironmentId
Property for EnvironmentId
Region
Property for Region
超时时间(毫秒)
Property for Timeout

事件

DeleteFileSuccess(响应代码,数据)
删除文件成功。responseCode: HTTP响应码, data: 删除结果数据
DownloadSuccess(响应代码,cloudPath,localFilePath,bytesWritten)
文件下载成功。responseCode: HTTP响应码, cloudPath: 云端路径, localFilePath: 本地保存路径, bytesWritten: 写入字节数
GetUrlSuccess(响应代码,URL网址)
获取文件链接成功。responseCode: HTTP响应码, url: 临时访问链接
RequestFailed(操作,错误代码,错误信息)
请求失败。operation: 操作名称, errorCode: 错误码, errorMessage: 错误信息
UploadSuccess(响应代码,数据)
文件上传成功。responseCode: HTTP响应码, data: 上传结果数据(含 cloudObjectId 和 downloadUrl)

方法

删除文件(cloudPath)
删除云文件。cloudPath: 云端路径(如 folder/file.jpg)或 UploadSuccess 返回的 cloudObjectId
下载文件(cloudPath,localFilePath)
下载云文件并保存到手机。cloudPath: 云端路径(如 folder/file.jpg)或 UploadSuccess 返回的 cloudObjectId。localFilePath: 本地保存路径,支持 /storage/…、file://、content://
GetFileUrl(cloudPath)
获取文件的临时访问链接,可以在Image图像组件中预览在线图片url。cloudPath: 云端路径或 cloudObjectId。成功后触发 GetUrlSuccess 事件。
UploadFile(cloudPath,文件路径)
上传本地文件到云存储。cloudPath 是云端相对路径,如 folder/file.jpg;filePath 是手机本地文件路径,支持 /storage/…、file://、content://。成功后 UploadSuccess 的 data 里包含 cloudObjectId 和 downloadUrl。

CustomWebView

Component for CustomWebView

Properties

AdHosts
Sets the ad hosts which will be blocked
AutoLoadImages
Returnss whether the WebView should load image resources
AutoplayMedia
Returns whether the WebView requires a user gesture to play media
BackgroundColor
Sets background color of webview
BlockAds
Sets whether to block ads or not
BlockNetworkLoads
Returns whether the WebView should not load resources from the network
CacheMode
Gets cache mode of active webview
CurrentPageTitle
Title of the page currently viewed
CurrentUrl
URL of the page currently viewed
Returns whether deep links are enabled or not
DesktopMode
Returns whether to load content in desktop mode
DisplayZoom
Gets whether the WebView should display on-screen zoom controls
EnableJS
Returns whether webview supports JavaScript execution
FileAccess
Returns whether webview can access local files
Sets whether to follow links or not
FontSize
Returns the font size of text
InitialScale
Sets the initial scale for active WebView. 0 means default. If initial scale is greater than 0, WebView starts with this value as initial scale.
LayerType
Gets layer type
LoadWithOverviewMode
Returns whether the WebView loads pages in overview mode
LongClickable
Returns whether text selection and context menu are enabled or not
OverScrollMode
Gets over scroll mode
PromptForPermission
Sets whether webview will prompt for permission and raise ‘OnPermissionRequest’ event or not else assume permission is granted.
RotationAngle
Gets rotation angle
ScrollBar
Whether to display horizonatal and vertical scrollbars or not
ScrollBarStyle
Gets scroll bar style
Scrollable
Property for Scrollable
SupportMultipleWindows
Returns whether the WebView supports multiple windows
UseWideViewPort
Returns whether the WebView should enable support for the ‘viewport’ HTML meta tag or should use a wide viewport.
UserAgent
Sets the WebView’s user-agent string. If the string is null or empty, the system default value will be used.
UsesLocation
Whether or not to give the application permission to use the Javascript geolocation API
VibrationEnabled
Returns whether vibration feedback enabled on long click
Visible
Returns the visibility of current webview
WebViewString
Get webview string
ZoomEnabled
Gets whether the WebView should support zooming using its on-screen zoom controls and gestures
ZoomPercent
Gets the zoom of the page in percent

Events

AfterArchiveSaved(success,filePath)
Event raised after ‘SaveArchive’ method.If ‘success’ is true then returns file path else empty string.
AfterJavaScriptEvaluated(result)
Event raised after evaluating Js and returns result.
CookiesRemoved(successful)
Event raised after ‘ClearCokies’ method with result
FileUploadNeeded(id,mimeType,isCaptureEnabled)
Event raised when file uploading is needed
FindResultReceived(id,activeMatchOrdinal,numberOfMatches,isDoneCounting)
Event raised after ‘Find’ method with int ‘activeMatchOrdinal’,’numberOfMatches’ and ‘isDoneCounting’
GotCertificate(isSecure,issuedBy,issuedTo,validTill)
Event raised after getting SSL certificate of current displayed url/website with boolean ‘isSecure’ and Strings ‘issuedBy’,’issuedTo’ and ‘validTill’.If ‘isSecure’ is false and other values are empty then assume that website is not secure
GotPrintResult(printId,isCompleted,isFailed,isBlocked)
Event raised after getting previus print’s result.
LongClicked(id,item,secondaryUrl,type)
Event raised when something is long clicked in webview with item(image,string,empty,etc) and type(item type like 0,1,8,etc)
OnCloseWindowRequest(id)
Event triggered when a window needs to be closed
OnConsoleMessage(message,lineNumber,sourceID,level)
Event raised after getting console message.
OnDownloadNeeded(id,url,contentDisposition,mimeType,size)
Event raised when downloading is needed.
OnErrorReceived(id,message,errorCode,url)
Event raised when any error is received during loading url and returns message,error code and failing url
OnFormResubmission(id)
Event raised when resubmission of form is needed
OnGeolocationRequested(origin)
Event raised when page asks for location access. Developer must handle/show dialog from him/herself.
OnHideCustomView()
Event raised when current page exits from full screen mode
OnJsAlert(id,url,message)
Event raised when Js have to show an alert to user
OnJsConfirm(id,url,message)
Tells to display a confirm dialog to the user.
OnJsPrompt(id,url,message,defaultValue)
Event raised when JavaScript needs input from user
OnNewWindowRequest(id,isDialog,isPopup)
Event raised when new window is requested by webview with boolean ‘isDialog’ and ‘isPopup’
OnPermissionRequest(permissionsList)
Event raised when a website asks for specific permission(s) in list format.
OnProgressChanged(id,progress)
Event raised when page loading progress has changed.
OnReceivedHttpAuthRequest(id,host,realm)
Notifies that the WebView received an HTTP authentication request.
OnReceivedSslError(errorCode)
Event for OnReceivedSslError
OnScrollChanged(id,scrollX,scrollY,oldScrollX,oldScrollY,canGoLeft,canGoRight)
Event raised when webview gets scrolled
OnShowCustomView()
Event raised when current page enters in full screen mode
PageLoaded(id)
Event raised when page loading has finished.
PageStarted(id,url)
Event indicating that page loading has started in web view.
Swiped(id,direction)
Event raised when webview is swiped
WebViewStringChanged(value)
When the JavaScript calls AppInventor.setWebViewString this event is run.

Methods

AllowGeolocationAccess(allow,remember)
Method for AllowGeolocationAccess
CanGoBack()
Gets whether this WebView has a back history item
CanGoBackOrForward(steps)
Gets whether the page can go back or forward the given number of steps.
CanGoForward()
Gets whether this WebView has a forward history item.
CancelPrinting()
Cancels current print job. You can request cancellation of a queued, started, blocked, or failed print job.
ClearCache()
Clears the resource cache.
ClearCookies()
Removes all cookies and raises ‘CookiesRemoved’ event
ClearFormData(id)
Clears the form data of the webview
Added by Xoma
ClearInternalHistory()
Tells this WebView to clear its internal back/forward list.
ClearLocation()
Clear all location preferences.
ClearMatches()
Clears the highlighting surrounding text matches.
ConfirmJs(confirm)
Whether to proceed JavaScript originated request
ContentHeight()
Gets height of HTML content
ContinueJs(input)
Inputs a confirmation response to Js
CreateShortcut(url,iconPath,title)
Creates a shortcut of given website on home screen
CreateWebView(container,id)
Creates the webview in given arrangement with id
CurrentId()
Returns current id
DismissJsAlert()
Dismiss previously requested Js alert
EvaluateJavaScript(script)
Asynchronously evaluates JavaScript in the context of the currently displayed page.
Find(string)
Finds all instances of find on the page and highlights them, asynchronously. Successive calls to this will cancel any pending searches.
FindNext(forward)
Highlights and scrolls to the next match if ‘forward’ is true else scrolls to previous match.
GetCookies(url)
Get cookies for specific url
GetIds()
Returns a list of used ids
GetInternalHistory(id)
Get internal history of given webview.
GetProgress(id)
Gets the progress for the given webview
GetScrollX()
Return the scrolled left position of the webview
GetScrollY()
Return the scrolled top position of the webview
GetSslCertificate()
Gets the SSL certificate for the main top-level page and raises ‘GotCertificate’ event
GetWebView(id)
Returns webview object from id
GoBack()
Goes back in the history of this WebView.
GoBackOrForward(steps)
Goes to the history item that is the number of steps away from the current item. Steps is negative if backward and positive if forward.
GoForward()
Goes forward in the history of this WebView.
GoToUrl(url)
Loads the given URL.
GrantPermission(permissions)
Grants given permissions to webview.Use empty list to deny the request.
HideCustomView()
Hides previously shown custom view
InvokeZoomPicker()
Invokes the graphical zoom picker widget for this WebView. This will result in the zoom widget appearing on the screen to control the zoom level of this WebView.Note that it does not checks whether zoom is enabled or not.
LoadHtml(html)
Loads the given data into this WebView using a ‘data’ scheme URL.
LoadInNewWindow(id)
Loads requested url in given webview
LoadWithHeaders(url,headers)
Loads the given URL with the specified additional HTTP headers defined is list of lists.
PageDown(bottom)
Scrolls the contents of the WebView down by half the page size
PageUp(top)
Scrolls the contents of the WebView up by half the page size
PauseWebView(id)
Does a best-effort attempt to pause any processing that can be paused safely, such as animations and geolocation. Note that this call does not pause JavaScript.
PostData(url,data)
Loads the URL with postData using ‘POST’ method into active WebView.
PrintWebContent(documentName)
Prints the content of webview with given document name
ProceedHttpAuthRequest(username,password)
Instructs the WebView to proceed with the authentication with the given credentials.If both parameters are empty then it will cancel the request.
ProceedSslError(proceed)
Method for ProceedSslError
Registers to open specified link in associated external app(s)
Reload()
Reloads the current URL.
RemoveWebView(id)
Destroys the webview and removes it completely from view system
RestartPrinting()
Restarts current/previous print job. You can request restart of a failed print job.
ResubmitForm(reSubmit)
Whether to resubmit form or not.
ResumeWebView(id)
Resumes the previously paused WebView.
SaveArchive(dir)
Saves the current site as a web archive
ScrollTo(x,y)
Scrolls the webview to given position
SetCookies(url,cookieString)
Sets cookies for given url
SetVisibility(id,visibility)
Sets the visibility of webview by id
SetWebView(id)
Set specific webview to current webview by id
StopLoading()
Stops the current load.
UploadFile(contentUri)
Uploads the given file from content uri.Use empty string to cancel the upload request.
ZoomBy(zoomP)
Performs a zoom operation in the WebView by given zoom percent
ZoomIn()
Performs zoom in in the WebView
ZoomOut()
Performs zoom out in the WebView

DeepSeek

调用 Chat 或图片对话方法后,按 StreamMode 在 GotStream 或 GotText 中读取内容;开启思考模式时还可在 GotReasoning 中读取思考输出。

Properties

APIKey
模型的Api Key。从深度求索获取 API Key »
BaseURL
DeepSeek 基础 URL,默认是官方地址,可修改接入第三方DeepSeek服务地址。
ModelName
模型名称。官方模型使用 deepseek-flash,同时支持文本和图片理解。调用 ChatWithImage/ChatWithImageUrl 时使用该模型。
ReasoningEffort
思考强度控制。high 适合普通对话,max 适合复杂推理和 Agent 类请求。
StreamMode
流式输出模式是否开启,默认’真’。 流式输出,即生成内容时边计算边返回,减少等待时间,提高响应速度,适用于聊天、代码补全等场景。 不开启,则是最终仅一次返回全部内容。
ThinkingEnabled
思考模式开关(由服务模型支持)。开启后模型会先思考再回答,回答质量更高但耗时更长、token 消耗更多。默认关闭。思考过程通过 GotReasoning 事件输出(不连接该事件即不显示)。

Events

GotReasoning(part,finished)
模型推理(思考)过程输出事件。part 为推理过程的增量内容,finished 标识推理是否结束。仅支持推理的模型(如 DeepSeek 思考模式)会触发。如果不需要显示思考过程,不连接本事件即可(即等于隐藏)。回答内容仍通过 GotStream(流式)/ GotText(非流式)输出。
GotStream(part,finished)
流式输出,每当有内容返回时都会触发该事件。part 为当前增量的部分内容,finished 标识输出是否已结束。
获得文本时(文本)
非流式输出完成时触发该事件。text 为完整输出内容。

Methods

Chat(内容)
开始与 DeepSeek 大模型进行对话。
ChatWithImage(提示,图片地址)
多模态对话:发送本地图片+文本。prompt: 提示词(如”描述这张图片”), imagePath: 手机本地图片路径。官方模型使用 deepseek-flash(支持图片,不支持视频)
ChatWithImageUrl(提示,imageUrl)
多模态对话:发送图片URL+文本。prompt: 提示词, imageUrl: 图片网络地址。官方模型使用 deepseek-flash(支持图片,不支持视频)
StartNewChat()
开启新对话。默认为多轮对话,此方法将开启一个全新的对话上下文。

DownloadHelper

Component for DownloadHelper

Properties

NotificationVisibility
Sets download notification visibility

Events

DownloadCompleted()
Event invoked when downloading gets completed
DownloadFailed()
Event invoked when downloading gets failed
DownloadProgressChanged(progress)
Event invoked when downloading progress changes
DownloadStarted(id)
Event invoked when downloading starts
GotFileSize(fileSize)
Event invoked after getting file size

Methods

Cancel()
Cancels the current download request
Download(url,mimeType,fileName,downloadDir)
Downloads the given file
GetFileSize(url)
Tries to get file size
GetMimeType(id)
Method for GetMimeType
GetUriString(id)
Method for GetUriString
GuessFileName(url,mimeType,contentDisposition)
Returns guessed file name

DynamicRecycler

DynamicRecycler 主组件类

继承自 ComponentBase,是整个动态列表扩展的核心入口。 负责:

  1. 创建和管理 RecyclerView 实例
  2. 设置各种回调过程(ViewProvider、ViewEditor 等)
  3. 管理布局管理器
  4. 处理数据更新和通知
  5. 提供滚动控制功能

Properties

Alpha
Property for Alpha
BackgroundColor
Property for BackgroundColor
BackgroundDrawable
Property for BackgroundDrawable
BackgroundTint
Property for BackgroundTint
Bottom
方向常量:下
ContentComparator
设置内容比较器(作用于最后创建的组件)
DiffUtils
启用/禁用 DiffUtil(作用于最后创建的组件)
Elevation
Property for Elevation
EmptyComponent
设置空视图组件(作用于最后创建的组件)
Enabled
Property for Enabled
HasFixedSize
设置是否固定大小(作用于最后创建的组件)
Height
Property for Height
HeightPercent
Property for HeightPercent
ItemComparator
设置项目比较器(作用于最后创建的组件)
LayoutManager
设置布局管理器(作用于最后创建的组件)
Left
方向常量:左
Padding
Property for Padding
PaddingBottom
Property for PaddingBottom
PaddingLeft
Property for PaddingLeft
PaddingRight
Property for PaddingRight
PaddingTop
Property for PaddingTop
Right
方向常量:右
ScrollChangedListener
设置滚动位置监听器(作用于最后创建的组件)
ScrollStateDragging
滚动状态常量:拖拽中
ScrollStateIdle
滚动状态常量:空闲
ScrollStateListener
设置滚动状态监听器(作用于最后创建的组件)
ScrollStateSettling
滚动状态常量:惯性滑动中
TestProcedures
设置是否启用过程测试

启用后,在构建时会验证 ViewProvider 等过程的返回值是否正确。 仅在开发模式(AI Companion)下生效。

Top
方向常量:上
ViewEditor
设置视图编辑器(作用于最后创建的组件)
ViewProvider
设置视图提供者(作用于最后创建的组件)
ViewTypeProvider
设置视图类型提供者(作用于最后创建的组件)
Visible
Property for Visible
Width
Property for Width
WidthPercent
Property for WidthPercent

Events

None

Methods

Build(component,dataList)
构建 RecyclerView 并绑定数据

这是使用 DynamicRecycler 的核心方法,必须在设置好 ViewProvider 和 LayoutManager 之后调用。

工作流程:

  1. 在开发模式下验证必要的过程是否已设置
  2. 根据是否启用 DiffUtil 创建相应的适配器
  3. 将适配器绑定到 RecyclerView
CanScrollHorizontally(component,direction)
检查是否可以水平滚动
CanScrollVertically(component,direction)
检查是否可以垂直滚动
Create(var1,var2)
Method for Create
CreateGridManager(spanCount,horizontal,reverseLayout,spacing)
创建网格布局管理器

将列表项排列成网格形式。

CreateLinearManager(horizontal,reverseLayout,stackFromEnd,spacing)
创建线性布局管理器

将列表项排列成单列或单行。

CreateStaggeredGridManager(spanCount,horizontal,reverseLayout,spacing)
创建瀑布流布局管理器

将列表项排列成瀑布流形式,适合不等高的项目。

GetComponentById(var1)
Method for GetComponentById
GetComponentInContainer(var1,var2)
Method for GetComponentInContainer
GetComponentPosition(component,childComponent)
获取组件在列表中的位置
GetHeight(var1)
Method for GetHeight
GetId(var1)
Method for GetId
GetLastComponent()
Method for GetLastComponent
GetWidth(var1)
Method for GetWidth
NotifyDataSetChanged(component)
通知数据集已更改(全量更新)

此方法会刷新所有可见项,性能较差,建议优先使用 DiffUtil 或 NotifyItemChanged 等精确更新方法。

注意:此方法不能与 DiffUtil 一起使用。

NotifyItemChanged(component,position)
通知单个项目已更改

更新指定位置的列表项。不能与 DiffUtil 一起使用。

NotifyItemInserted(component,position)
通知项目已插入

在指定位置插入新项。不能与 DiffUtil 一起使用。

NotifyItemRemoved(component,position)
通知项目已移除

移除指定位置的项。不能与 DiffUtil 一起使用。

RemoveContentComparator(component)
移除内容比较器过程
RemoveEmptyComponent(component)
移除空视图组件
RemoveItemComparator(component)
移除项目比较器过程
RemoveLayoutManager(component)
移除布局管理器
RemoveScrollChangedListener(component)
移除滚动位置变化监听器过程
RemoveScrollStateListener(component)
移除滚动状态监听器过程
RemoveViewEditor(component)
移除视图编辑器过程
RemoveViewProvider(component)
移除视图提供者过程
RemoveViewTypeProvider(component)
移除视图类型提供者过程
ScrollTo(component,position)
滚动到指定位置

立即滚动到指定位置,无动画效果。

SetContentComparator(component,procedureName)
设置内容比较器过程(用于 DiffUtil)

用于判断两个数据项的内容是否相同(决定是否需要更新视图)。 启用 DiffUtil 时必须设置此过程。

过程签名:procedure(id, oldItem, newItem)

  • id: RecyclerView 的 ID
  • oldItem: 旧数据项
  • newItem: 新数据项

过程应返回:Boolean

SetEmptyComponent(component,emptyComponent)
设置空视图组件

当列表数据为空时显示此组件。

SetHasFixedSize(component,hasFixedSize)
设置是否具有固定大小

如果 RecyclerView 的大小不会因内容变化而改变,设置为 true 可以优化性能。

SetItemComparator(component,procedureName)
设置项目比较器过程(用于 DiffUtil)

用于判断两个数据项是否代表同一个对象(通常比较 ID)。

过程签名:procedure(id, oldItem, newItem)

  • id: RecyclerView 的 ID
  • oldItem: 旧数据项
  • newItem: 新数据项

过程应返回:Boolean

SetLayoutManager(component,layoutManager)
设置布局管理器

布局管理器决定列表项的排列方式(线性、网格、瀑布流等)。 使用 CreateLinearManager、CreateGridManager 或 CreateStaggeredGridManager 创建。

SetScrollChangedListener(component,procedureName)
设置滚动位置变化监听器过程

监听 RecyclerView 的滚动位置变化。

过程签名:procedure(id, x, y)

  • id: RecyclerView 的 ID
  • x: 水平滚动偏移量
  • y: 垂直滚动偏移量
SetScrollStateListener(component,procedureName)
设置滚动状态监听器过程

监听 RecyclerView 的滚动状态变化。

过程签名:procedure(id, scrollState)

  • id: RecyclerView 的 ID
  • scrollState: 滚动状态(0=空闲, 1=拖拽中, 2=惯性滑动中)
SetViewEditor(component,procedureName)
设置视图编辑器过程

ViewEditor 用于在数据绑定时更新列表项视图内容。

过程签名:procedure(id, position, root, viewType)

  • id: RecyclerView 的 ID
  • position: 当前项的位置(从 1 开始)
  • root: 列表项的根容器
  • viewType: 视图类型
SetViewProvider(component,procedureName)
设置视图提供者过程

ViewProvider 是创建列表项视图的核心过程,必须设置。

过程签名:procedure(id, root, viewType)

  • id: RecyclerView 的 ID
  • root: 列表项的根容器(LayoutContainer)
  • viewType: 视图类型(用于多类型列表)

过程应返回:Boolean 或 AndroidViewComponent

SetViewTypeProvider(component,procedureName)
设置视图类型提供者过程

用于实现多类型列表,根据位置返回不同的视图类型。

过程签名:procedure(id, position)

  • id: RecyclerView 的 ID
  • position: 当前项的位置(从 1 开始)

过程应返回:Number(视图类型编号)

SmoothScrollTo(component,position)
平滑滚动到指定位置

带动画效果滚动到指定位置。

UpdateData(component,newDataList)
更新数据

使用新数据列表更新 RecyclerView。

  • 如果启用了 DiffUtil,会自动计算差异并应用动画
  • 如果未启用 DiffUtil,会执行全量更新
UseComponent(var1)
Method for UseComponent
UseComponentInContainer(var1,var2)
Method for UseComponentInContainer
UseComponentWithId(var1)
Method for UseComponentWithId
UseDiffUtil(component,useDiffUtil)
启用或禁用 DiffUtil

DiffUtil 可以智能计算数据变更,自动应用添加、删除、移动等动画。 启用后需要设置 ContentComparator,可选设置 ItemComparator。

注意:启用 DiffUtil 后,应使用 UpdateData 方法更新数据, 而不是 NotifyItemChanged 等方法。

Dynamics

Component for Dynamics

Properties

Automatic
Property for Automatic
FillParent
Property for FillParent

Events

None

Methods

GenerateId()
Method for GenerateId
GetComponentsCount()
Method for GetComponentsCount
ImportTypeface(var1)
Method for ImportTypeface
IsActive(var1)
Method for IsActive
IsEnabled(var1)
Method for IsEnabled
IsPressed(var1)
Method for IsPressed
IsSelected(var1)
Method for IsSelected
SetActive(var1,var2)
Method for SetActive
SetElevation(var1,var2)
Method for SetElevation
SetEnabled(var1,var2)
Method for SetEnabled
SetFullMargin(var1,var2,var3,var4,var5)
Method for SetFullMargin
SetMargin(var1,var2)
Method for SetMargin
SetOpacity(var1,var2)
Method for SetOpacity
SetPressed(var1,var2)
Method for SetPressed
SetSelected(var1,var2)
Method for SetSelected
SetTextShadow(var1,var2,var3,var4,var5)
Method for SetTextShadow
SetTranslationX(var1,var2,var3)
Method for SetTranslationX
SetTranslationY(var1,var2,var3)
Method for SetTranslationY

ECharts

Component for ECharts

Properties

ShowAnimation
动画是否开启。
ShowValue
是否显示数字提示。
ThemeIndex
主题设置,数字:1 default, 2 dark, 3 macarons, 4 roma, 5 shine, 6 vintage, 7 infographic
TransparentBackground
背景是否透明,需在Init初始化之前设置。
YAxisMin
Y轴刻度最小显示值:一个数字 - Y轴从该数字开始,或 ‘dataMin’ - 取数据中最小值 或 ‘null’ - 自动计算

Events

Clicked(legend,label,value)
图表被点击时触发。参数 legend: 当前被点击的图例; label: 当前被点击的标签; data: 当前被点击的数据。
ImageSaved(imagePath)
图片保存完成时触发,参数为图片路径(保存失败时不触发)

Methods

Bar(title,legends,labels,datas)
画柱状图。title:标题,文本; legends: 图例,列表; labels: 标签,列表; datas: 数据,二维列表。
Gauge(startAngle,endAngle,min,max,value)
画仪表图。startAngle:起始角度; endAngle:结束角度; min:最小值; max:最大值; value:当前值。
Init(layout)
图表拓展初始化。参数是布局对象,指示图表显示的位置。
Line(title,legends,labels,datas,smooth)
画折线图。title:标题,文本; legends: 图例,列表; labels: 标签,列表; datas: 数据,二维列表;smooth:是否平滑。
Pie(title,radius,data)
画饼图。title:标题,文本; radius:半径,列表,如[‘33%’,’60%’]-空心饼图,[‘60%’]-实心饼图; data:{value,name}字典列表,例如 [ { value: 484, name: ‘项目1’ },{ value: 300, name: ‘项目2’ } ]
SaveImage(imageName)
将图表作为图像保存到 ASD 目录。

ECharts3D

Component for ECharts3D

Properties

ShowAnimation
动画是否开启。
ShowValue
是否显示数字提示。
ThemeIndex
主题设置,数字:1 default, 2 dark, 3 macarons, 4 roma, 5 shine, 6 vintage, 7 infographic
TransparentBackground
背景是否透明,需在Init初始化之前设置。
YAxisMin
Y轴刻度最小显示值:一个数字 - Y轴从该数字开始,或 ‘dataMin’ - 取数据中最小值 或 ‘null’ - 自动计算

Events

Clicked(legend,label,value)
图表被点击时触发。参数 legend: 当前被点击的图例; label: 当前被点击的标签; data: 当前被点击的数据。
ImageSaved(imagePath)
图片保存完成时触发,参数为图片路径(保存失败时不触发)

Methods

Init(layout)
layout: where the chart to be shown
SaveImage(imageName)
将图表作为图像保存到 ASD 目录。
SimpleSurface(title,data)
根据数据点画3D曲面·简单曲面。第一个参数:标题。第二个参数:[x,y,z]三元素列表的列表,例如 [ [-5, -5, 0.5], [-4, -5, 0.6], … ]
SimpleSurfaceWithEquation(title,equationJsonStr)
根据坐标方程式画3D曲面·简单曲面。第一个参数:标题。第二个参数:坐标方程式JSON字符串,详见帮助文档。

Excel

Component for Excel

Properties

None

Events

None

Methods

ClearCell(fileName,sheetName,row,col)
删除指定单元格内容。fileName 为 Excel 路径,sheetName 为工作表名称,row/col 从 1 开始。
ClearSheet(fileName,sheetName)
清空指定工作表内容。fileName 为 Excel 路径,sheetName 为工作表名称。
CreateWorkbook(fileName,sheetName)
创建一个新的 Excel 文件。fileName 为输出路径,sheetName 为首个工作表名称。支持 .xlsx 和 .xls。
GetAll(xlsFileName,sheetIndex)
读取 Excel 文件全部内容,返回二维列表。 xlsFileName: Excel 文件路径名。//开始表明在素材内,/sdcard/开始表明在sdcard上。 sheetIndex:工作表编号。要读取第几个工作表。
GetCell(xlsFileName,sheetIndex,row,col)
读取某个单元格内容,返回文本。 xlsFileName: Excel 文件路径名。//开始表明在素材内,/sdcard/开始表明在sdcard上。 sheetIndex:工作表编号。要读取第几个工作表。 row: 第几行 col: 第几列
GetColumn(xlsFileName,sheetIndex,col)
读取某列内容,返回列表。 xlsFileName: Excel 文件路径名。//开始表明在素材内,/sdcard/开始表明在sdcard上。 sheetIndex:工作表编号。要读取第几个工作表。 col: 第几列
GetRow(xlsFileName,sheetIndex,row)
读取某行内容,返回列表。 xlsFileName: Excel 文件路径名。//开始表明在素材内,/sdcard/开始表明在sdcard上。 sheetIndex:工作表编号。要读取第几个工作表。 row: 第几行
SheetNames(fileName)
返回工作表名称列表。
WriteCell(fileName,sheetName,row,col,value)
写入单元格。fileName 为 Excel 路径,sheetName 为工作表名称,row/col 从 1 开始。文件不存在时会自动创建。
WriteRow(fileName,sheetName,row,data)
写入一整行。fileName 为 Excel 路径,sheetName 为工作表名称,row 从 1 开始,data 为一维列表。
WriteTable(fileName,sheetName,startRow,startCol,data)
写入二维表。fileName 为 Excel 路径,sheetName 为工作表名称,startRow/startCol 从 1 开始,data 为二维列表。

FTPClient

Component for FTPClient

Properties

Encoding
字符集编码方式。

Events

Connected()
连接操作完成后触发此事件。
DownloadFileFinished(desFilePath)
下载文件操作完成后触发此事件。
UploadFileFinished(srcFilePath)
上传文件操作完成后触发此事件。

Methods

ChangeDirectory(dir_path)
更改当前远程目录。例如:/public_html/my_directory。如果位于路径中,则只需输入目录名称即可。
Connect(host,port,username,password)
连接到 FTP 服务器。连接完成后会触发 Connected 事件。
CreateDirectory(dir_path)
在指定路径中创建目录。例如:/public_html/my_directory。如果位于该路径中,则只需输入目录名称即可。
DeleteDirectory(dir_path)
删除指定目录。例如:/public_html/my_directory。如果位于该路径中,则只需输入目录名称即可。
DeleteFile(file_Path)
删除指定文件。例如:/public_html/my_directory/my_file.txt。如果位于该路径中,则只需输入文件名称即可。
Disconnect()
断开与服务器的连接。
DownloadFile(srcFilePath,desFilePath)
下载文件。例如:/public_html/my_directory/my_file.txt。如果位于该路径中,则只需输入文件名称即可。目标路径可以是: /mnt/sdcard/my_file.txt。操作完成后会触发 DownloadFileFinished 事件。
GetCurrentDirectory()
获取当前远程目录。
ListDirectory(dir_path)
获取指定目录下的列表(文件或子目录的列表)。
RenameFile(current,newName)
重命名文件。输入当前名称和新名称。例如:/public_html/my_directory/my_file.txt。如果位于该路径中,则只需输入文件名称即可。
UploadFile(srcFilePath,desFileName)
上传文件。例如:/public_html/my_directory/my_file.txt。如果位于该路径中,则只需输入文件名称即可。源文件路径可以是: /mnt/sdcard/my_file.txt。操作完成后会触发 UploadFileFinished 事件。

手电筒(FlashLight)

Component for FlashLight

属性

None

事件

None

方法

是否开启(IsOn)()
获取手电筒当前状态
关灯(Off)()
关闭手电筒
开灯(On)()
打开手电筒
切换开关(Toggle)()
切换手电筒状态

Kimi

Component for Kimi

Properties

APIKey
模型的Api Key。
ModelName
模型名称。
StreamMode
流式输出模式是否开启,默认’真’。 流式输出,即生成内容时边计算边返回,减少等待时间,提高响应速度,适用于聊天、代码补全等场景。 不开启,则是最终仅一次返回全部内容。

Events

GotStream(part,finished)
流式输出,每当有内容返回时都会触发该事件。part 为当前增量的部分内容,finished 标识输出是否已结束。
GotText(text)
非流式输出完成时触发该事件。text 为完整输出内容。

Methods

Chat(content)
开始与 Kimi 大模型进行对话。
StartNewChat()
开启新对话。默认为多轮对话,此方法将开启一个全新的对话上下文。

LinearProgressbar

Component for LinearProgressbar

Properties

None

Events

ProgressChanged(container,id,progress)
当进度条进度变化时触发。

Methods

CreateLinearProgressbar(container,id,color,indeterminate)
在指定容器中创建横向进度条。id 必须唯一。
CreateUsableId(container)
创建一个可用的唯一 id。
GetMaximum(container,id)
返回最大值。
GetMinimum(container,id)
返回最小值。低版本返回 0。
GetProgress(container,id)
获取当前进度。
IncrementProgressBy(container,id,value)
增加指定进度值。
IsIndeterminate(container,id)
返回当前是否为不确定模式。
SetIndeterminate(container,id,indeterminate)
设置是否为不确定模式。
SetIndeterminateColor(container,id,color)
设置进度条不确定模式颜色。
SetMaximum(container,id,max)
设置最大值。
SetMinimum(container,id,min)
设置最小值。仅 Android 8.0 及以上生效。
SetPadding(container,id,left,top,right,bottom)
设置进度条内边距。
SetProgress(container,id,progress)
设置当前进度。若为不确定模式则不会生效。
SetProgressColor(container,id,color)
设置进度条主颜色。

Markdown

Component for Markdown

Properties

TransparentBackground
设置WebView背景是否透明

Events

OnImageGenerated(imagePath)
图片保存完成时触发,参数为图片路径(失败时返回空字符串)
OnPreviewReady()
Markdown预览加载完成时触发

Methods

MarkdownPreview(layout,markdown)
预览Markdown内容到指定布局(不生成图片)
MarkdownToHtml(markdown)
将Markdown文本转换为HTML
SaveToImage(isPublic)
将当前预览内容保存为图片,isPublic 为 “真” 时保存到相册,“假” 时保存到App私有目录。

MyListView

Component for MyListView

Properties

AsyncImageLoad
Property for AsyncImageLoad
CacheImage
Property for CacheImage
ElementHeight
Property for ElementHeight
ExtraButtonBgColor
Property for ExtraButtonBgColor
ExtraButtonEnabled
Property for ExtraButtonEnabled
ExtraButtonHeight
Property for ExtraButtonHeight
ExtraButtonImage
Property for ExtraButtonImage
ExtraButtonPaddings
Property for ExtraButtonPaddings
ExtraButtonShape
Property for ExtraButtonShape
ExtraButtonText
Property for ExtraButtonText
ExtraButtonTextFontBold
Property for ExtraButtonTextFontBold
ExtraButtonTextFontSize
Property for ExtraButtonTextFontSize
ExtraButtonWidth
Property for ExtraButtonWidth
IconBgColor
Property for IconBgColor
IconHeight
Property for IconHeight
IconMultiParams
Property for IconMultiParams
IconPaddings
Property for IconPaddings
IconShape
Property for IconShape
IconTextColor
Property for IconTextColor
IconTextFontBold
Property for IconTextFontBold
IconTextFontSize
Property for IconTextFontSize
IconWidth
Property for IconWidth
LastClickedElement
Property for LastClickedElement
LastClickedExtraButton
Property for LastClickedExtraButton
LastClickedIcon
Property for LastClickedIcon
LastLongClickedElement
Property for LastLongClickedElement
ScrollBottomAfterAdd
Property for ScrollBottomAfterAdd
SubTextColor
Property for SubTextColor
SubTextFontBold
Property for SubTextFontBold
SubTextFontSize
Property for SubTextFontSize
SubTextHeight
Property for SubTextHeight
TextColor
Property for TextColor
TextFontBold
Property for TextFontBold
TextFontSize
Property for TextFontSize
TextHeight
Property for TextHeight
TouchDownColor
Property for TouchDownColor
UnderlineColor
Property for UnderlineColor
UnderlineWidth
Property for UnderlineWidth
WidthAfterIcon
Property for WidthAfterIcon
WidthBeforeExtraButton
Property for WidthBeforeExtraButton
WidthBeforeIcon
Property for WidthBeforeIcon

Events

ElementClick(elementIndex)
Event for ElementClick
ElementLongClick(elementIndex)
Event for ElementLongClick
ElementTouchDown(elementIndex)
Event for ElementTouchDown
ElementTouchUp(elementIndex)
Event for ElementTouchUp
ExtraButtonClick(elementIndex)
Event for ExtraButtonClick
ExtraButtonLongClick(elementIndex)
Event for ExtraButtonLongClick
ExtraButtonTouchDown(elementIndex)
Event for ExtraButtonTouchDown
ExtraButtonTouchUp(elementIndex)
Event for ExtraButtonTouchUp
IconClick(elementIndex)
Event for IconClick
IconLongClick(elementIndex)
Event for IconLongClick
IconTouchDown(elementIndex)
Event for IconTouchDown
IconTouchUp(elementIndex)
Event for IconTouchUp

Methods

AddElement(element)
Method for AddElement
AddEmptyElement()
Method for AddEmptyElement
Clear()
Method for Clear
ClearAllCache()
Method for ClearAllCache
ClearCache(path)
Method for ClearCache
Get()
Method for Get
GetElement(elementIndex)
Method for GetElement
Initialize(verticalArrangement)
Method for Initialize
Initialize_Scroll(verticalScrollArrangement)
Method for Initialize_Scroll
RemoveElement(elementIndex)
Method for RemoveElement
Set(list)
Method for Set
SetElement(elementIndex,element)
Method for SetElement
SetElementIcon(elementIndex,path)
Method for SetElementIcon
SetElementMainText(elementIndex,mainText)
Method for SetElementMainText
SetElementSubText(elementIndex,subText)
Method for SetElementSubText
SetElementText(elementIndex,text)
Method for SetElementText

MyListViewElement

Component for MyListViewElement

Properties

ElementBackgroundColor
Property for ElementBackgroundColor
ElementHeight
Property for ElementHeight
ElementValue
Property for ElementValue
ExtraButtonBackgroundColor
Property for ExtraButtonBackgroundColor
ExtraButtonHeight
Property for ExtraButtonHeight
ExtraButtonImage
Property for ExtraButtonImage
ExtraButtonShape
Property for ExtraButtonShape
ExtraButtonText
Property for ExtraButtonText
ExtraButtonTextFontBold
Property for ExtraButtonTextFontBold
ExtraButtonTextFontSize
Property for ExtraButtonTextFontSize
ExtraButtonWidth
Property for ExtraButtonWidth
IconBackgroundColor
Property for IconBackgroundColor
IconHeight
Property for IconHeight
IconImage
Property for IconImage
IconShape
Property for IconShape
IconTextColor
Property for IconTextColor
IconTextFontBold
Property for IconTextFontBold
IconTextFontSize
Property for IconTextFontSize
IconWidth
Property for IconWidth
Size
Property for Size
SubText
Property for SubText
SubTextColor
Property for SubTextColor
SubTextFontBold
Property for SubTextFontBold
SubTextFontSize
Property for SubTextFontSize
SubTextHeight
Property for SubTextHeight
Text
Property for Text
TextColor
Property for TextColor
TextFontBold
Property for TextFontBold
TextFontSize
Property for TextFontSize
TextHeight
Property for TextHeight
UnderlineColor
Property for UnderlineColor
UnderlineWidth
Property for UnderlineWidth
UseGlobalProperties
Property for UseGlobalProperties
WidthAfterIcon
Property for WidthAfterIcon
WidthBeforeExtraButton
Property for WidthBeforeExtraButton
WidthBeforeIcon
Property for WidthBeforeIcon

Events

None

Methods

ElementBackgroundColor(listview,elementIndex)
Method for ElementBackgroundColor
ElementBackgroundColor_(listview,elementIndex,argb)
Method for ElementBackgroundColor_
ElementHeight(listview,elementIndex)
Method for ElementHeight
ElementHeight_(listview,elementIndex,height)
Method for ElementHeight_
ElementValue(listview,elementIndex)
Method for ElementValue
ElementValue_(listview,elementIndex,value)
Method for ElementValue_
ExtraButtonBackgroundColor(listview,elementIndex)
Method for ExtraButtonBackgroundColor
ExtraButtonBackgroundColor_(listview,elementIndex,argb)
Method for ExtraButtonBackgroundColor_
ExtraButtonHeight(listview,elementIndex)
Method for ExtraButtonHeight
ExtraButtonHeight_(listview,elementIndex,height)
Method for ExtraButtonHeight_
ExtraButtonImage(listview,elementIndex)
Method for ExtraButtonImage
ExtraButtonImage_(listview,elementIndex,value)
Method for ExtraButtonImage_
ExtraButtonShape(listview,elementIndex)
Method for ExtraButtonShape
ExtraButtonShape_(listview,elementIndex,shape)
Method for ExtraButtonShape_
ExtraButtonText(listview,elementIndex)
Method for ExtraButtonText
ExtraButtonTextFontBold(listview,elementIndex)
Method for ExtraButtonTextFontBold
ExtraButtonTextFontBold_(listview,elementIndex,bold)
Method for ExtraButtonTextFontBold_
ExtraButtonTextFontSize(listview,elementIndex)
Method for ExtraButtonTextFontSize
ExtraButtonTextFontSize_(listview,elementIndex,size)
Method for ExtraButtonTextFontSize_
ExtraButtonText_(listview,elementIndex,text)
Method for ExtraButtonText_
ExtraButtonWidth(listview,elementIndex)
Method for ExtraButtonWidth
ExtraButtonWidth_(listview,elementIndex,width)
Method for ExtraButtonWidth_
IconBackgroundColor(listview,elementIndex)
Method for IconBackgroundColor
IconBackgroundColor_(listview,elementIndex,argb)
Method for IconBackgroundColor_
IconHeight(listview,elementIndex)
Method for IconHeight
IconHeight_(listview,elementIndex,height)
Method for IconHeight_
IconImage(listview,elementIndex)
Method for IconImage
IconImage_(listview,elementIndex,value)
Method for IconImage_
IconShape(listview,elementIndex)
Method for IconShape
IconShape_(listview,elementIndex,shape)
Method for IconShape_
IconTextColor(listview,elementIndex)
Method for IconTextColor
IconTextColor_(listview,elementIndex,argb)
Method for IconTextColor_
IconTextFontBold(listview,elementIndex)
Method for IconTextFontBold
IconTextFontBold_(listview,elementIndex,bold)
Method for IconTextFontBold_
IconTextFontSize(listview,elementIndex)
Method for IconTextFontSize
IconTextFontSize_(listview,elementIndex,size)
Method for IconTextFontSize_
IconWidth(listview,elementIndex)
Method for IconWidth
IconWidth_(listview,elementIndex,width)
Method for IconWidth_
LinkToElement(listview,elementIndex)
Method for LinkToElement
Size(listview,elementIndex)
Method for Size
SubText(listview,elementIndex)
Method for SubText
SubTextColor(listview,elementIndex)
Method for SubTextColor
SubTextColor_(listview,elementIndex,argb)
Method for SubTextColor_
SubTextFontBold(listview,elementIndex)
Method for SubTextFontBold
SubTextFontBold_(listview,elementIndex,bold)
Method for SubTextFontBold_
SubTextFontSize(listview,elementIndex)
Method for SubTextFontSize
SubTextFontSize_(listview,elementIndex,size)
Method for SubTextFontSize_
SubTextHeight(listview,elementIndex)
Method for SubTextHeight
SubTextHeight_(listview,elementIndex,height)
Method for SubTextHeight_
SubText_(listview,elementIndex,subtext)
Method for SubText_
Text(listview,elementIndex)
Method for Text
TextColor(listview,elementIndex)
Method for TextColor
TextColor_(listview,elementIndex,argb)
Method for TextColor_
TextFontBold(listview,elementIndex)
Method for TextFontBold
TextFontBold_(listview,elementIndex,bold)
Method for TextFontBold_
TextFontSize(listview,elementIndex)
Method for TextFontSize
TextFontSize_(listview,elementIndex,size)
Method for TextFontSize_
TextHeight(listview,elementIndex)
Method for TextHeight
TextHeight_(listview,elementIndex,height)
Method for TextHeight_
Text_(listview,elementIndex,text)
Method for Text_
UnderlineColor(listview,elementIndex)
Method for UnderlineColor
UnderlineColor_(listview,elementIndex,argb)
Method for UnderlineColor_
UnderlineWidth(listview,elementIndex)
Method for UnderlineWidth
UnderlineWidth_(listview,elementIndex,lineWidth)
Method for UnderlineWidth_
UseGlobalProperties(listview,elementIndex)
Method for UseGlobalProperties
UseGlobalProperties_(listview,elementIndex,useGlobal)
Method for UseGlobalProperties_
WidthAfterIcon(listview,elementIndex)
Method for WidthAfterIcon
WidthAfterIcon_(listview,elementIndex,width)
Method for WidthAfterIcon_
WidthBeforeExtraButton(listview,elementIndex)
Method for WidthBeforeExtraButton
WidthBeforeExtraButton_(listview,elementIndex,width)
Method for WidthBeforeExtraButton_
WidthBeforeIcon(listview,elementIndex)
Method for WidthBeforeIcon
WidthBeforeIcon_(listview,elementIndex,width)
Method for WidthBeforeIcon_

NetworkState

Component for NetworkState

Properties

None

Events

NetworkState(state)
反馈网络状态,参数的值为以下字符串:WIFI、2G、3G、4G、未连接网络、未知网络

Methods

GetNetworkState()
获取网络状态,返回值为以下字符串:WIFI、2G、3G、4G、未连接网络、未知网络

NotificationStyle

Component for NotificationStyle

Properties

Channel
获取通道名称。
ColorNotification
获得通知的颜色。
IconNotification
获取图标资源的路径。
ImportanceChannel
获取优先通道。
PriorityNotification
获得优先通知。

Events

CallbackButtonAction(nameAction)
单击任何操作按钮时,该块将返回相应按钮的名称。
CallbackButtonProgress(nameButton)
返回进度通知中按下的操作按钮的名称。
CallbackMessage(message,timestamp)
返回通知中输入的消息。
CallbackMusicPlayer(nameAction)
当点击媒体样式通知的任意按钮时,该块中返回Action的名称。

Methods

ActionNotification(title,subtitle,bigText,bigPicture,largeIcon,listButtons,startValue,id)
通过此块,可以在通知中创建最多三个操作按钮,此外,还可以添加“超链接”。
BigPictureNotification(title,subtitle,bigPicture,largeIcon,startValue,id)
创建带有大图片的通知,此外还可以添加标题、副标题和大图标。
CancelAllNotification()
取消所有通知。
CancelMusicNotification()
删除 MediaStyle 通知。
CancelNotification(id)
取消指定消息的通知。
CancelProgressNotification()
取消进度通知。
ClearAllMessage()
当调用 MessageReceiverNotification 方法时,它会存储添加的消息,要删除,请使用此方法。
ConfirmSendingMessage()
如果用户响应通知中的消息,它将显示一个加载图标,直到该块被使用。
GetFavorite()
获取该歌曲是否被标记为收藏。
LargeIconNotification(title,subtitle,bigText,largeIcon,startValue,id)
在通知中显示带有标题和副标题的大图标。
PauseMusicNotification()
带有播放按钮显示 MediaStyle 的通知。
PlayMusicNotification()
显示带有暂停按钮的 MediaStyle 通知。
ProgressNotification(title,subtitle,subtext,buttons,currentProgress,maxProgress,indeterminate,ongoing)
创建带有进度条的通知。
ReceiverMessageNotification(group,message,sender,timestamp)
通过这个块,可以显示收到的消息通知,并可以在栏中回复。
SetProgress(subtitle,subtext,currentProgress)
调整通知进度条。
SetupMusicNotification(title,subtitle,largeIcon,favorite)
启动 MediaStyle 通知初始化。
SimpleNotification(title,subtitle,bigText,startValue,id)
创建一个带有标题和副标题的简单通知,能够在副标题中显示大文本。

OCR

先调用 Init,在 Initialized 的 success 为真后识别图片;在 GotText 中读取文字,ErrorOccurred 中处理错误。Release 后必须重新初始化。

Properties

Busy
是否正在识别中;识别期间再次调用识别方法会被忽略并触发 ErrorOccurred。
语言
识别语言,对应 tessdata 里的模型名,默认 chi_sim(简体中文)。要用其它语言,把对应的 .traineddata 加进应用素材,再把本属性设成它的文件名(不含扩展名)。
Ready
引擎是否已就绪(Init 成功后为真)。

Events

出现错误时(消息)
出错时触发。
获得文本时(文本)
识别成功时触发,text 为识别出的文字。
已初始化时(是否成功,消息)
初始化完成时触发;success 为真表示引擎已就绪。

Methods

Init()
初始化识别引擎(首次会把模型解到应用私有目录)。异步执行,完成后触发 Initialized 事件。
RecognizeBase64(Base64文本)
识别 Base64 编码图片里的文字(可带 data:image/…;base64, 前缀)。
RecognizeImageComponent(imageComponent)
识别 Image 组件当前显示图片里的文字。
RecognizeImageFile(路径)
识别图片文件里的文字。路径可以是素材名、/sdcard 路径或 file:// 地址。异步执行,成功后触发 GotText 事件。
释放()
释放引擎占用的内存;之后需要重新 Init。

PdfTool

Component for PdfTool

Properties

None

Events

None

Methods

ExtractImages(filename,mime)
仅从 pdf 中解析图像到 pdf 同目录。filename 是 pdf 文件的路径。mime 是生成图片的扩展名,例如 png、jpg。
ExtractImagesTo(filename,outputDir,mime)
仅从 pdf 中解析图像到指定目录。filename 是 pdf 文件路径,outputDir 是输出目录,mime 是生成图片的扩展名,例如 png、jpg。返回成功导出的图片数量。
ExtractText(filename,to)
仅从 pdf 中解析文本(成功测试英语)。filename 是 pdf 文件的路径。to 是文本文件的路径。
GetPages(filename)
返回pdf文件的页数。filename是pdf文件的路径。

PdfViewer

Component for PdfViewer

Properties

None

Events

OnError(error)
Event for OnError
PdfLoaded(totalPage)
Event for PdfLoaded
Scrolled(pageInView)
Event for Scrolled

Methods

Goto(page)
滚动到页面。
LoadPDF(layout,pdfPath)
将 pdf 加载到布局中。pdfPath:如 ‘//assets.pdf’ 或 ‘asd.pdf’
Preview(pageRange)
显示 pdf。pageRange 类似于 ‘1’、’2-5’ 或 ‘1,3-5’。留空则显示全部。

PhoneInfo

Component for PhoneInfo

Properties

None

Events

None

Methods

GetAndroidId()
获取 ANDROID_ID。该值是 Android 提供的应用可访问设备标识,相比 GetDeviceID / GetSerialNumber 更容易在主流设备上获取到。注意:它不是 IMEI,也不是硬件 SN;恢复出厂设置、部分多用户环境或极少数定制系统下,该值可能变化或为空。一般用于应用侧标识设备时,优先推荐使用它。
GetDeviceID()
获取设备ID(旧接口)。注意:该值依赖 TelephonyManager,在 Android 高版本、无 SIM 设备、平板、纯 Wi-Fi 设备或权限未授予时,系统可能直接返回空文本。若只是需要稳定的应用级设备标识,建议优先使用 GetAndroidId。
GetLocationState()
获取定位功能状态,返回值为:开启或关闭
GetMacAddress()
获取网卡MAC地址信息
GetPhoneModel()
获取本机手机型号
GetPhoneNumber()
获取本机手机号码。无SIM卡设备将返回空文本;双SIM卡设备将返回主卡号码。
GetReleaseVersion()
获取系统版本
GetSDKVersion()
获取SDK版本
GetSerialNumber()
获取设备 SN 序列号。注意:SN 属于系统级硬件标识,Android 高版本对第三方应用限制很严,即使声明权限也可能返回空文本。如果只是用于区分安装设备,请优先使用 GetAndroidId。
SysLang()
获取系统默认语言。

Plyr

Component for Plyr

Properties

CaptionsVisible
切换字幕可见性
ControlsCaptions
Property for ControlsCaptions
ControlsCurrentTime
Property for ControlsCurrentTime
ControlsDuration
Property for ControlsDuration
ControlsForward
Property for ControlsForward
ControlsFullScreen
Property for ControlsFullScreen
ControlsMute
Property for ControlsMute
ControlsPlay
Property for ControlsPlay
ControlsPlayLarge
Property for ControlsPlayLarge
ControlsProgress
Property for ControlsProgress
ControlsRewind
Property for ControlsRewind
ControlsSettings
Property for ControlsSettings
ControlsVisible
切换控制界面可见性
ControlsVolume
Property for ControlsVolume
CurrentQuality
更改媒体质量
CurrentTrack
设置当前轨道
Loop
切换循环播放
MediaTypeAudio
Property for MediaTypeAudio
MediaTypeHls
Property for MediaTypeHls
MediaTypeVideo
Property for MediaTypeVideo
MediaTypeVimeo
Property for MediaTypeVimeo
MediaTypeYouTube
Property for MediaTypeYouTube
SetSource
设置媒体源
Speed
更改播放速度
Thumbnail
设置缩略图

Events

GotMetadata(data)
视频元数据加载时触发的事件
GotText(text)
播放器返回当前时间字幕文本时触发的事件
LoadingState(isLoading)
加载状态改变时触发的事件
OnComplete()
视频播放完成时触发的事件
OnError(error)
发生错误时触发的事件
OnFullScreenChanged(isFullscreen)
全屏状态改变时触发的事件
OnPause()
视频暂停时触发的事件
OnPlay()
视频播放时触发的事件
OnReady()
播放器准备就绪时触发的事件
TimeUpdated(time)
时间变化时触发的事件
TrackAdded(title,language)
添加新轨道时触发的事件

Methods

AddSubtitle(path,language)
添加字幕
Format(milliseconds)
将毫秒转换为 hh:mm:ss 时间格式
Forward(milliseconds)
向前跳转
GetMetadata()
获取元数据(与视频相关的属性,如标题、类型、质量等)
Initialize(layout,path,thumbnail,subtitle,subtitlesLang,mediaType,controls)
初始化播放器
Pause()
暂停媒体
Play()
播放媒体
RemoveSubtitles()
移除所有字幕
Rewind(milliseconds)
向后跳转
SeekTo(milliseconds)
跳转到特定毫秒数
Stop()
停止媒体播放并重置到初始位置

PrivacyPolicyAI2Ext

Component for PrivacyPolicyAI2Ext

Properties

None

Events

OnAgreed()
当用户同意隐私政策时触发。
OnPrivacyConfirmClosed(id)
当隐私确认框关闭时触发。
OnPrivacyConfirmContinue(id)
当用户点击继续按钮时触发。
OnRejected()
当用户拒绝隐私政策时触发。

Methods

HasAgreed()
检查用户是否已经同意隐私政策。
ResetAgreement()
重置隐私政策同意状态。
ResetPrivacyConfirm(id)
重置隐私确认框的显示状态
ResetRejection()
重置隐私政策拒绝状态。
ShowFromFile(filePath)
从本地文件加载隐私政策弹窗。
ShowFromHtml(htmlContent)
从HTML内容加载隐私政策弹窗。
ShowFromUrl(url)
从URL加载隐私政策弹窗。
ShowPrivacyConfirmDialog(id,content)
隐私确认弹窗。

二维码生成(QRCodeGenerator)

QRCodeGenerator 拓展,用于生成二维码。 简单易用的二维码生成器拓展,可定制二维码颜色、背景色。

属性

前景色(BlackColor)
获取二维码的前景色。
背景色(WhiteColor)
获取二维码的背景色。

事件

出错时(OnError)(消息)
二维码生成失败时触发。
生成成功时(OnSuccess)()
二维码生成成功时触发。

方法

生成二维码(GenerateQRCode)(文本,组件)
生成二维码并显示在指定的视图组件上(如:布局组件、图像组件等)。

Qwen

Component for Qwen

Properties

APIKey
模型的Api Key。
ModelName
模型名称。
StreamMode
流式输出模式是否开启,默认’真’。 流式输出,即生成内容时边计算边返回,减少等待时间,提高响应速度,适用于聊天、代码补全等场景。 不开启,则是最终仅一次返回全部内容。

Events

GotStream(part,finished)
流式输出,每当有内容返回时都会触发该事件。part 为当前增量的部分内容,finished 标识输出是否已结束。
GotText(text)
非流式输出完成时触发该事件。text 为完整输出内容。

Methods

Chat(content)
开始与千问大模型进行对话。
StartNewChat()
开启新对话。默认为多轮对话,此方法将开启一个全新的对话上下文。

RotationDetector

Component for RotationDetector

Properties

MyCanvas
Property for MyCanvas

Events

Rotate(angle)
当检测到双指旋转时触发,返回本次角度变化。

Methods

AddHandlerToCanvas(myCanvas)
将旋转检测器绑定到指定 Canvas。
RemoveHandlerFromCanvas()
从当前 Canvas 移除旋转检测器。

SQLite(SQLite)

当前 SQLite 是内置存储组件。属性、方法、事件与案例统一参见 SQLite 组件参考 和 SQLite 使用指南,避免旧扩展接口与当前版本混用。

ScaleDetector

This example demonstrates how to add a new gesture detector to App Inventor using App Inventor extensions. It creates a component called ScaleDetector. ScaleDetector is used in conjunction with a Canvas. It provides a When Scale event hander that fires when there is a scale gesture (e.g. a two-finger pinch) on the canvas. Once could use a similar technique to create other extensions that add other kinds of gesture detectors and handlers to canvases.

Properties

MyCanvas
Property for MyCanvas

Events

Scale(scaleFactor)
Event for Scale

Methods

AddHanderToCanvas(myCanvas)
Input is the canvas component on which to install the detector
AddHandlerToCanvas(myCanvas)
将缩放检测器绑定到指定 Canvas。 这是 AddHanderToCanvas 的正确拼写别名。
RemoveHandlerFromCanvas()
从当前 Canvas 移除缩放检测器。

Screenshot

Component for Screenshot

Properties

FileName
Set fileName

Events

AfterScreenshot(image)
The AfterScreenshot event

Methods

TakeScreenshot()
Take a screenshot

Shortcut

Component for Shortcut

Properties

None

Events

None

Methods

CreateShortcut(name,icon,packageName,duplicate)
在 Android 手机桌面上创建快捷方式。

Component for Sidebar

None

AfterSelecting(itemPosition,itemValue,iconCode)
菜单项选择后的事件。
Create(input2,listItem,icons,imagen)
创建侧边栏。
Hide()
隐藏侧边栏。
IsShow()
侧边栏是否是显示状态。
Show()
显示侧边栏。

StatusBarTools

Component for StatusBarTools

Properties

None

Events

None

Methods

BGTransparentColor(hexColor)
背景更改为透明颜色。
BackgroundColor(hexColor)
修改背景颜色。
BackgroundTransparent()
背景更改为透明。
IconDark()
图标颜色更改为深色。
IconLight()
图标颜色更改为浅色。

TableView

Component for TableView

Properties

BorderColor
表格边框颜色,如:red or #ccc。
BorderWidth
表格边框宽度,如:1 or 1px。
CellPadding
单元格padding属性,如:3 or 3px。
FontSize
字体大小,如:14 or 14px。
FootBgColor
页脚背景颜色,如:red or #ccc。
HasFoot
表格是否有页脚。
HasHead
表格是否有表头。
HeadBgColor
表头背景颜色,如:red or #ccc。
TransparentBackground
Property for TransparentBackground

Events

Click(row,col,value)
当表格被点击时。
OnScroll(row,col)
当表格滚动时(如果容器/布局高度设置为自动则不起作用)。
OnShowTable()
表格显示完成时(ShowTable 函数调用后触发)。

Methods

ClearTable()
清除表格数据。
Init(layout)
初始化表格视图到一个布局对象中。
ScrollTo(row,col,smooth)
表格视图滚动到指定的行和列。smooth:是否平滑滚动(如果容器/布局高度设置为自动,则不起作用)。
SetData(data)
设置数据:一个二维列表(列表的列表)
ShowTable()
显示数据表格。

TransparentBackground

Component for TransparentBackground

Properties

None

Events

None

Methods

TransparentLayout(layout,transp)
设置布局组件背景是否透明。
TransparentWebView(webviewer,transp)
设置WebView(Web浏览器组件)背景是否透明。

UIEnhance

Component for UIEnhance

Properties

None

Events

None

Methods

FullScreen()
隐藏系统状态栏和导航栏,进入沉浸式全屏。
SetAsCard(layout,color,radius,borderWidth,borderColor,padding,margin,elevation)
把布局容器设置成卡片风格。 color: 背景色 radius: 圆角半径,单位为 dp borderWidth: 边框宽度,单位为 dp borderColor: 边框颜色 padding: 内边距,单位为 dp margin: 外边距,单位为 dp elevation: 阴影高度,单位为 dp
SetBackgroundImage(component,imagePath,borderWidth,borderColor,roundRadius)
设置组件背景图片,并可同时应用边框和圆角。 imagePath: 图片路径,支持素材路径 // 或文件路径 borderWidth: 边框宽度,单位为 dp borderColor: 边框颜色 roundRadius: 单个值表示四角一致;四个值表示左上、右上、右下、左下。单位为 dp。
SetBgColor(component,fillColor,orient)
设置组件背景色或渐变背景。 fillColor: 单个颜色值,或 JSON 颜色列表,如 [-1,-16776961] orient: 渐变方向,0-7 分别表示左到右、左下到右上、下到上、右下到左上、右到左、右上到左下、上到下、左上到右下
SetBorder(component,borderWidth,borderColor)
设置边框。必须先通过 SetBgColor 或 SetBackground 创建可修改的背景。 borderWidth: 边框宽度,单位为 dp borderColor: 边框颜色
SetClipChildren(component,clip)
设置布局是否裁剪超出边界的子组件。
SetElevation(component,elevation)
设置组件阴影高度,单位为 dp。
SetLetterSpace(component,space)
设置文本组件字间距。0 为默认值。
SetLineSpace(component,space)
设置文本组件的行间距增量,单位为像素。
SetMargin(component,margin)
设置组件外边距。 margin: 单个值表示四边一致;四个值表示左、上、右、下。单位为 dp。
SetPadding(component,padding)
设置组件内边距。 padding: 单个值表示四边一致;四个值表示左、上、右、下。单位为 dp。
SetRoundCorner(component,radius)
设置圆角。必须先通过 SetBgColor 或 SetBackground 创建可修改的背景。 radius: 单个值表示四角一致;四个值表示左上、右上、右下、左下。单位为 dp。
setFontTypeface(component,fontName)
设置文本组件字体。 fontName 以 // 开头表示素材字体,否则按本地文件路径处理。
文档反馈