"ui";
ui.layout(<vertical><button id="autoFloatWindow" text="开启悬浮窗" textSize="15sp" /><button id="autoService" text="开启无障碍服务" textSize="15sp" /><button id="fw" text="打开悬浮窗" /><button id="fw2" text="输出一串日志" /></vertical>
);
ui.autoService.on("click", function () {//弹出无障碍服务设置app.startActivity({action: "android.settings.ACCESSIBILITY_SETTINGS"});});ui.autoFloatWindow.on("click", function () {//申请悬浮窗importClass(android.content.Intent);importClass(android.net.Uri);importClass(android.provider.Settings);var intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,Uri.parse("package:" + context.getPackageName()));intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);app.startActivity(intent);
});ui.fw.on("click", function () {threads.start(function(){console.show();});
});
ui.fw2.on("click", function () {threads.start(function(){console.log("123");console.log("456");console.log("123");console.log("123");console.log("123");console.log("123");console.log("123");console.log("123");console.log("123");console.log("123");console.log("888");});
});
输出效果: