"ui";
/* 主页面 */
ui.layout(
<frame >
<vertical gravity="center" >
<text textColor="#000000" gravity="center" text="这里是主页面" textSize="14sp" />
<button id="main" text="跳转页面1" style="Widget.AppCompat.Button.Colored" />
</vertical>
</frame>
);
const ViewGroup = activity.getWindow().getDecorView().findViewById(android.R.id.content).getChildAt(0)/* 主页面根视图 */
let layout1 = ui.inflate(/* 页面1 */
<frame >
<vertical gravity="center" >
<text textColor="#000000" gravity="center" text="这里是页面1" textSize="14sp" />
<button id="y1" text="跳转页面2" style="Widget.AppCompat.Button.Colored" />
</vertical>
</frame>, ViewGroup);
let layout2 = ui.inflate(/* 页面2 */
<frame >
<vertical gravity="center" >
<text textColor="#000000" gravity="center" text="这里是页面2" textSize="14sp" />
<button id="y2" text="跳转主页面" style="Widget.AppCompat.Button.Colored" />
</vertical>
</frame>, ViewGroup);
ui.main.on("click", () => {
ui.setContentView(layout1)
})
layout1.y1.on("click", () => {
ui.setContentView(layout2)
})
layout2.y2.on("click", () => {
ui.setContentView(ViewGroup)
})
多页面切换_Autojs
最新推荐文章于 2025-04-15 11:10:08 发布