AutoJS自定义模态框,弹出框

Autojs的文档内容相对比较少,控件写的要不全,有时候在日常开发中,官方的哪些组件,少有满足我们的需求,本人在Auto.js中也是个新萌,高手请指教:我们直接上代码吧

"ui";
var ifshow = true;
var listurl = [{ url: "1", index: 1 }, { url: "2", index: 2 }, { url: "3", index: 3 }, { url: "4", index: 4 }];
ui.layout(
    <frame>
        <vertical>
            <button id="showDialogs">aa</button>
        </vertical>
        <linear w="*" h="*" bg="#a0000000" id="dialogs" gravity="center">
            <vertical w="400" bg="#ffffff" padding="10">
                //这里就是你模态框的内容布局


            </vertical>
        </linear>
    </frame >
);// visibility="gone"
ui.urllistbox.setDataSource(listurl);
ui.dialogs.click(function () {
    if (!ifshow) {
        ui.dialogs.setVisibility(0);
        ifshow = false;
    } else {
        ui.dialogs.setVisibility(8);
        ifshow = true;
    }
})
ui.showDialogs.click(function () {
    ui.dialogs.setVisibility(0);
    ifshow = true;
    ui.urllistbox.setDataSource(listurl);
});

让你们好理解 一点,加个案例:

"ui";
var ifshow = true;
var listurl = [{ url: "1", index: 1 }, { url: "2", index: 2 }, { url: "3", index: 3 }, { url: "4", index: 4 }];
ui.layout(
    <frame>
        <vertical>
            <button id="showDialogs">aa</button>
        </vertical>
        <linear w="*" h="*" bg="#a0000000" id="dialogs" gravity="center">
            <vertical w="400" bg="#ffffff" padding="10">
                <list id="urllistbox">
                    <horizontal marginTop="5">
                        <text w="60" ellipsize="middle" maxLines="1" text="标题{{index}}:" size="12" color="#000000"></text>
                        <input text="{{url}}" size="12" w="260" color="#3399ff" marginLeft="5" marginRight="5"/>
                        <text padding="4" size="12" bg="#EA4A36" color="#ffffff">确认</text>
                    </horizontal>
                </list>
            </vertical>
        </linear>
    </frame >
);// visibility="gone"
ui.urllistbox.setDataSource(listurl);
ui.dialogs.click(function () {
    if (!ifshow) {
        ui.dialogs.setVisibility(0);
        ifshow = false;
    } else {
        ui.dialogs.setVisibility(8);
        ifshow = true;
    }
})
ui.showDialogs.click(function () {
    ui.dialogs.setVisibility(0);
    ifshow = true;
    ui.urllistbox.setDataSource(listurl);
});
上一篇:微信小程序引用 iconfont


下一篇:【Android工具】安卓手机淘宝双十二活动脚本,1212淘宝冲能量半自动程序