版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 河南省新乡市部分学校2026-2027学年高一上学期开学考试化学试卷(含解析)
- 2026-2027学年九年级上学期第四单元 中古时期的亚洲、非洲和美洲 单元测试(含答案)
- 兽医助理岗位诊疗考试试卷及答案
- 烧烤店串品穿制工岗位技能考试试卷及答案
- 注射剂工安全宣传强化考核试卷含答案
- 玉米收获机操作工安全文化考核试卷含答案
- 总溶剂生产工岗前工作流程考核试卷含答案
- 2026年师德师风知识试题(附答案)
- 特种弹簧制作工安全教育水平考核试卷含答案
- 炼钢原料工诚信品质评优考核试卷含答案
- 2026广西壮族自治区交通运输厅直属事业单位重点领域急需紧缺高层次人才招聘39人考试备考题库及答案详解
- 2025-2026 学年七年级上期末语文试卷
- 融资渠道2026年融资咨询服务合同
- 2026成人高考专升本语文模拟测试试题及答案
- 2026秋统编版(新教材)九年级历史上册(全册)每课核心知识点清单梳理
- 2026秋小学统编版道德与法治五年级上册教学计划含进度表
- 工程项目部绩效考核实施细则
- GA/T 1999.3-2025道路交通事故车辆速度鉴定方法第3部分:基于视频图像
- brc内审员考试试题及答案
- 2026年联通考试试题及答案
- 云梯车安全专项施工方案
评论
0/150
提交评论