"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");});
});
輸出效果: