Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
2_2_8-Ball(魔术8球)
Search
powerhope
August 11, 2016
2
120
2_2_8-Ball(魔术8球)
App Inventor移动应用开发
powerhope
August 11, 2016
Tweet
Share
More Decks by powerhope
See All by powerhope
1_App Inventor初步
powerhope
0
190
2_1_HelloPurr
powerhope
0
130
3_App Inventor编程基础
powerhope
0
100
4_组件-用户界面
powerhope
0
140
5_组件-界面布局
powerhope
0
140
6_组件-多媒体
powerhope
0
89
7_组件-绘图动画
powerhope
0
110
8_组件-传感器
powerhope
0
120
9_组件-社交应用
powerhope
0
140
Featured
See All Featured
Faster Mobile Websites
deanohume
299
30k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
357
22k
Building a Modern Day E-commerce SEO Strategy
aleyda
17
6.4k
What the flash - Photography Introduction
edds
64
11k
The Language of Interfaces
destraynor
151
23k
We Have a Design System, Now What?
morganepeng
43
6.7k
Embracing the Ebb and Flow
colly
80
4.1k
Git: the NoSQL Database
bkeepers
PRO
422
63k
Gamification - CAS2011
davidbonilla
76
4.6k
Unsuck your backbone
ammeep
663
57k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
What's new in Ruby 2.0
geeforr
337
31k
Transcript
College of Mathematics and Computer Science, Hunan Normal University 瞿绍军
湖南师范大学数学与计算机科学学院
College of Mathematics and Computer Science, Hunan Normal University
服务器网址 ◦ http://ai2.appinventor.mit.edu/ ◦ http://app.gzjkw.net 资源 ◦ http://appinventor.mit.edu/ 网址
College of Mathematics and Computer Science, Hunan Normal University
当完成这个App,摇晃一下手机,你会收到 一个预言。 8-Ball(魔术8球)
College of Mathematics and Computer Science, Hunan Normal University
用Chrome (谷歌浏览器) 打开了App Inventor 主 页http://ai2.appinventor.mit.edu或 http://app.gzjkw.net 用你的电子邮件地址账号注册和登录. 如果已经创建了项目(如HelloPurr),系统将自 动进入到上次项目的设计界面,点击左上角的“项 目” 登录服务器
College of Mathematics and Computer Science, Hunan Normal University
如果点击“我的项目”将进入到项目列表;直接点 击“新建项目”按钮。 新建项目
College of Mathematics and Computer Science, Hunan Normal University
Magic8Ball应用中需要四个可视组件: 一个“按钮【Button】”组件,显示8球; 二个“标签【Label】”组件,显示文字“问魔术8 球一个问题”和“点击魔术8球来收到一个回答”; 一个“垂直布局【VerticalArrangement】”组件 ,用来布局标签组件。 一个非可视的“声音【Sound】”组件,用来播放 声音。 一个“加速度传感器【AccelerometerSensor】” 组件,用于检测设备的摇动。 界面设计
College of Mathematics and Computer Science, Hunan Normal University
上传素材(magic8ball.jpg和Tada.mp3) 界面设计
College of Mathematics and Computer Science, Hunan Normal University
增加按钮并修改属性 “图像”属性,选择“magic8ball.jpg” “文本”属性:删除“按钮1文本” “宽度”和“高度”分别为“300像素”。 界面设计
College of Mathematics and Computer Science, Hunan Normal University 界面设计
College of Mathematics and Computer Science, Hunan Normal University
增加音效 界面设计
College of Mathematics and Computer Science, Hunan Normal University 添加组件行为,触摸按钮发出声音
College of Mathematics and Computer Science, Hunan Normal University
增加界面布局组件。从“组件面板”的“用户界面 ”中拖动“垂直布局”到“Screen1”的按钮下面 实现单击按钮,输出一个预言
College of Mathematics and Computer Science, Hunan Normal University
在“组件面板”的“用户界面”中拖动“标签”到 “Screen1”中“垂直布局”里面 用鼠标选定添加的“标签1”,在“组件属性”窗 口中修改“文本”为“问魔术8球一个问题”。用 同样的方式增加“标签2”,文本为:“点击魔术8 球来收到一个回答” 增加标签
College of Mathematics and Computer Science, Hunan Normal University
College of Mathematics and Computer Science, Hunan Normal University
打开块编辑器,即逻辑设计 添加组件行为
College of Mathematics and Computer Science, Hunan Normal University
单击块编辑器中“模块”下的“Screen1”中“标 签2”,在弹出的抽屉中选中“设 标签2.文本 为【 set Label2.Text to】”模块并拖放到前面添加的 代码块中。 添加组件行为
College of Mathematics and Computer Science, Hunan Normal University
College of Mathematics and Computer Science, Hunan Normal University
为了实现触摸魔术8球就会得到一个答案,采用“ 列表【Lists】”存放答案,每次从答案中随机选择 一个。列表相当于一个集合可以存放多个答案。 添加组件行为
College of Mathematics and Computer Science, Hunan Normal University
College of Mathematics and Computer Science, Hunan Normal University
College of Mathematics and Computer Science, Hunan Normal University
假设这里需要设置6个答案:那是肯定的、毫无疑 问、在我看来,是的、别指望它、我的消息来源说没 有、无法预测现在。
College of Mathematics and Computer Science, Hunan Normal University
College of Mathematics and Computer Science, Hunan Normal University 添加“内置块”中的“文本”
College of Mathematics and Computer Science, Hunan Normal University
College of Mathematics and Computer Science, Hunan Normal University
添加“加速度传感器”,并添加代码块 实现晃动手机,输出一个预言
College of Mathematics and Computer Science, Hunan Normal University
测试,参照HelloPurr。 测试
College of Mathematics and Computer Science, Hunan Normal University
如果你想把应用分享给朋友或发布到应用市场,就 需要把应用打包成apk文件。AI2提供了二种打包方 式。 打包apk并显示二维码 打包apk并下载到电脑 打包和下载应用
College of Mathematics and Computer Science, Hunan Normal University
丰富Magic8Ball内容,让它变得更有趣。 实验三