




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Widget简介及基本开发方法Widget(微件)是一块可以在任何基于HTML的Web页面上执行的代码,表现形式可能是视频,地图,新闻,小游戏等。Widget起源Widget的创想来苹果公司电脑工程师Rose1998年,Rose在Mac操作系统使用一个可以更换皮肤的MP3播放器时突发奇想:如果桌面上运行的所有工具都能够更换皮肤或外观,将是很酷的事情,他称之为“Konfabulator”2003年2月Konfabulator1.0正式发布运行在苹果操作系统上的小工具其中的主执行文件叫Widget2003年7月Konfabulator1.5发布主执行文件Widget的开发开始流行,Konfabulator更名为Widget2004年11月Widget1.8发布Widget支持Windows和Mac操作系统Widget的主要特征身材微:一般尺寸很小,方便嵌入终端快速运行功能巨:Widget能够主动从互联网获取信息形式多:Widget有多种呈现形式,如幻灯秀、视频、地图、新闻、小游戏……姿容丽:Widget将狭窄单调的浏览器窗口变为广阔绚丽的桌面空间个性化:用户可以根据自己的喜好,将多个Widget重新排列组合成自己的互联网桌面易制作:Widget制作简单,需要使用图像处理工具,具备HTML/XML和Java知识--《网络整合营销兵器谱》Widgetvs.普通网页Widget无需浏览器可以直接显示在桌面Widget可以同时与多个Web服务器上的不同Web服务交互Widget有一个widget对象通过JavaScript调用该对象的函数Widget在本地有一个永久的存储空间类似于Cookies机制的保存设置和下载信息Widget通常有多个视图通过JavaScript/CSS技术实现视图间的切换Widget默认可以拖动可以指出不响应拖动的控制域Widget默认背景是透明的Widget的透明部分不响应任何鼠标事件典型Widget包含的文件Widget配置文件Widget配置文件根目录,包含Widget的基本信息,如名称、尺寸、作者和安全信息。首页文件类似于网页中的index文件,给出Widget的基本结构和内容。图像所有图像文件都在名为images的文件夹中。
JavaScript脚本文件所有脚本文件都在名为script的文件夹中。
Stylesheet
样式表文件所有样式表单都在名为style的文件夹中。Widget开发的技术要求Web相关技术的基础知识Web设计IDE软件或创建JavaScript,HTML和CSS文件的文本编辑器创建.zip文件的工具发布Widget的网站常见Widget桌面WidgetYahoo!WidgetGoogleWidgetOperaWidget/手机WidgetNokiaWidgetSamsungWidgetJILWidgetAndroidWidget社交网站WidgetFacebookWidget人人网/开心网Widget盛大WidgetAndroid发展历史2003年Android成立2005年Google并购Android2007年11月发布Android2008年9月发布Android1.02009年2月发布Android1.12009年4月发布Android1.5(Cupcake)2009年9月发布Android1.6(Donut)2009年10月发布Android2.0(Eclair)2010年1月发布Android2.12010年5月发布Android2.2(Froyo)2010年10月发布Android3.0(Gingerbread)?年?月发布Android3.5(Honeycomb)Android开发环境开发环境Java运行时库(JRE)AndroidSDK2.2Eclispe3.*ADTPluginforEclipseAndroidAPIReference链接
/reference/packages.html将Widget添加到手机模拟器Menu->Add->WidgetAndroidWidgetsWidgetsareafeatureintroducedinAndroid1.5.Awidgetdisplaysanapplication'smostimportantortimelyinformationataglance,onauser'sHomescreen.Androidwidgetshavethreemaincomponents:aboundingboxaframethewidget'sgraphicalcontrolsandotherelementsAndroidAppWidgetsAppWidgetsareminiatureapplicationviewsthatcanbeembeddedinotherapplicationsandreceiveperiodicupdates.TheseviewsarereferredtoasWidgetsintheuserinterfaceUserscanpublishWidgetswithanAppWidgetprovider.AnapplicationcomponentthatisabletoholdotherAppWidgetsiscalledanAppWidgethost.BasicsofAndroidAppWidgetsAppWidgetProviderInfoobjectDescribesthemetadataforanAppWidgetinXML,suchastheAppWidget'slayout,updatefrequency,andtheAppWidgetProviderclass.AppWidgetProviderclassimplementationDefinesthebasicmethodsthatallowyoutoprogrammaticallyinterfacewiththeAppWidget,basedonbroadcastevents.Throughit,youwillreceivebroadcastswhentheAppWidgetisupdated,enabled,disabledanddeleted.ViewlayoutDefinestheinitiallayoutfortheAppWidgetinXML.AppWidgetconfigurationActivityimplement.ThisisanoptionalActivitythatlauncheswhentheuseraddsanAppWidgetandallowsusertomodifyAppWidgetsettingsatcreate-time.DeclaringanAppWidgetinManifestDeclaretheAppWidgetProviderclassinyourapplication'sAndroidManifest.xmlfile.AddingtheAppWidgetProviderInfoMetadataTheAppWidgetProviderInfodefinestheessentialqualitiesofanAppWidgetsuchasitsminimumlayoutdimensions,itsinitiallayoutresource,howoftentoupdatetheAppWidget,and(optionally)aconfigurationActivitytolaunchatcreate-time.DefinetheAppWidgetProviderInfoobjectinanXMLresourceusingasingle<appwidget-provider>elementandsaveitintheproject'sres/xml/folder.CreatingtheAppWidgetLayoutDefineaninitiallayoutforyourAppWidgetinXMLandsaveitintheproject'sres/layout/directory.BefamiliarwithDeclaringLayoutinXMLBeawareofRemoteViewsUsingtheAppWidgetProviderClassTheAppWidgetProviderclassextendsBroadcastReceivertohandletheAppWidgetbroadcasts.TheAppWidgetProviderreceivesonlytheeventbroadcaststhatarerelevanttotheAppWidgetsuchaswhentheAppWidgetisupdated,deleted,enabled,anddisabled.Whenthesebroadcasteventsoccur,theAppWidgetProviderreceivesthefollowingmethodcalls:onUpdate(Context,AppWidgetManager,int[])
onDeleted(Context,int[])
onEnabled(Context)
onDisabled(Context)
onReceive(Context,Intent)
AppWidgetProviderisaconvenienceclass.IfyouwouldliketoreceivetheAppWidgetbroadcastsdirectly,youcanimplementyourownBroadcastReceiveroroverridetheonReceive(Context,Intent)callback.ThefourIntents:ACTION_APPWIDGET_UPDATE
ACTION_APPWIDGET_DELETED
ACTION_APPWIDGET_ENABLED
ACTION_APPWIDGET_DISABLED
CreatinganAppWidgetConfigurationActivityAnAppWidgetconfigurationActivityisneededifuserswanttoconfiguresettingswhenheorsheaddsanewAppWidget.ActivitywillbeautomaticallylaunchedbytheAppWidgethostandallowstheusertoconfigureavailablesettingsfortheAppWidgetatcreate-time,suchastheAppWidgetcolor,size,updateperiodorotherfunctionalitysettings.TheconfigurationActivityshouldbedeclaredasanormalActivityintheAndroidmanifestfile.ItwillbelaunchedbytheAppWidgethostwiththeACTION_APPWIDGET_CONFIGUREaction.TheconfigurationActivitymustbedeclaredintheAppWidgetProviderInfoXMLfile,withtheandroid:configureattribute.ImplementtheactualActivityTheAppWidgethostcallstheconfigurationActivityandtheconfigurationActivityshouldalwaysreturnaresult.Theresultshouldinclud
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025工程分包安全生产责任合同范本
- 2024年北京科技职业学院辅导员考试真题
- 连锁股东对审计师行为的影响研究
- 湖南省长沙市望城区第一中学2025届高三收官考试数学试卷(解析)
- 2025年二手奢侈品鉴定标准与市场竞争力提升策略研究及案例分析
- 2025年二手交易电商信用数据安全与隐私保护研究报告
- 2025年二手交易电商平台信用评价标准制定与执行报告001
- 医疗设备回收与再利用企业制定与实施新质生产力项目商业计划书
- 音乐喷泉与灯光表演企业制定与实施新质生产力项目商业计划书
- 新型普通诊察器械企业制定与实施新质生产力项目商业计划书
- 2024届四川省锦江区七中学育才生物七年级第二学期期末达标检测模拟试题含解析
- 【试卷】-《新能源汽车整车控制系统检修》课程考试试卷(闭卷)A卷
- 出口管制与国际贸易合规经营的法律法规解读
- 万人相亲大会招商计划书
- 福建省2022年6月普通高中学业水平合格性考试生物试卷(含答案)
- FamaFrench三因子模型和五因子模型对A股钢铁企业的实证检验
- 2023年北京中考英语听后转述含技巧和练习 课件
- 团员组织关系转接介绍信(样表)
- 抖音员工号申请在职证明参考模板
- 2023年广东初中学业水平考试生物试卷真题(含答案)
- 医院电子病历系统应用水平分级评价 4级实证材料选择项
评论
0/150
提交评论