16楼的计算器虽然简单,但是需要使用网络,现在来一个不使用网络的:
1.设计界面跟上面那个相同(原来的网络客户端 (web)就不用了),再添加一个计时器(启用计时设为假,计时间隔设为10到20都行),添加一个网络浏览框(webviewer)(可见性设为假)
2. 新建一个math.html文件,文件内容为以下内容,并上传到素材库:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
window.onload=function(){
var result;
try {
result=eval(window.AppInventor.getWebViewString());
}
catch(exception) {
result="ERROR";
}
window.AppInventor.setWebViewString(result);
}
</script>
</body>
</html>
3.逻辑设计(其他按钮的事件与16楼相同):