应用程序基础Android Developers毕业设计外文翻译Word文档下载推荐.docx
- 文档编号:15799477
- 上传时间:2022-11-16
- 格式:DOCX
- 页数:12
- 大小:107.78KB
应用程序基础Android Developers毕业设计外文翻译Word文档下载推荐.docx
《应用程序基础Android Developers毕业设计外文翻译Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《应用程序基础Android Developers毕业设计外文翻译Word文档下载推荐.docx(12页珍藏版)》请在冰豆网上搜索。
ApplicationFundamentals
AndroidapplicationsarewrittenintheJavaprogramminglanguage.ThecompiledJavacode—alongwithanydataandresourcefilesrequiredbytheapplication—isbundledbytheaapttoolintoanAndroidpackage,anarchivefilemarkedbyan.apksuffix.Thisfileisthevehiclefordistributingtheapplicationandinstallingitonmobiledevices;
it'
sthefileusersdownloadtotheirdevices.Allthecodeinasingle.apkfileisconsideredtobeoneapplication.
Inmanyways,eachAndroidapplicationlivesinitsownworld:
1.Bydefault,everyapplicationrunsinitsownLinuxprocess.Androidstartstheprocesswhenanyoftheapplication'
scodeneedstobeexecuted,andshutsdowntheprocesswhenit'
snolongerneededandsystemresourcesarerequiredbyotherapplications.
2.Eachprocesshasitsownvirtualmachine(VM),soapplicationcoderunsinisolationfromthecodeofallotherapplications.
3.Bydefault,eachapplicationisassignedauniqueLinuxuserID.Permissionsaresetsothattheapplication'
sfilesarevisibleonlytothatuserandonlytotheapplicationitself—althoughtherearewaystoexportthemtootherapplicationsaswell.
It'
spossibletoarrangefortwoapplicationstosharethesameuserID,inwhichcasetheywillbeabletoseeeachother'
sfiles.Toconservesystemresources,applicationswiththesameIDcanalsoarrangetoruninthesameLinuxprocess,sharingthesameVM.
ApplicationComponents
AcentralfeatureofAndroidisthatoneapplicationcanmakeuseofelementsofotherapplications(providedthoseapplicationspermitit).Forexample,ifyourapplicationneedstodisplayascrollinglistofimagesandanotherapplicationhasdevelopedasuitablescrollerandmadeitavailabletoothers,youcancalluponthatscrollertodothework,ratherthandevelopyourown.Yourapplicationdoesn'
tincorporatethecodeoftheotherapplicationorlinktoit.Rather,itsimplystartsupthatpieceoftheotherapplicationwhentheneedarises.
Forthistowork,thesystemmustbeabletostartanapplicationprocesswhenanypartofitisneeded,andinstantiatetheJavaobjectsforthatpart.Therefore,unlikeapplicationsonmostothersystems,Androidapplicationsdon'
thaveasingleentrypointforeverythingintheapplication(nomain()function,forexample).Rather,theyhaveessentialcomponentsthatthesystemcaninstantiateandrunasneeded.Therearefourtypesofcomponents:
Activities
Anactivitypresentsavisualuserinterfaceforonefocusedendeavortheusercanundertake.Forexample,anactivitymightpresentalistofmenuitemsuserscanchoosefromoritmightdisplayphotographsalongwiththeircaptions.Atextmessagingapplicationmighthaveoneactivitythatshowsalistofcontactstosendmessagesto,asecondactivitytowritethemessagetothechosencontact,andotheractivitiestoreviewoldmessagesorchangesettings.Thoughtheyworktogethertoformacohesiveuserinterface,eachactivityisindependentoftheothers.EachoneisimplementedasasubclassoftheActivitybaseclass.
Anapplicationmightconsistofjustoneactivityor,likethetextmessagingapplicationjustmentioned,itmaycontainseveral.Whattheactivitiesare,andhowmanytherearedepends,ofcourse,ontheapplicationanditsdesign.Typically,oneoftheactivitiesismarkedasthefirstonethatshouldbepresentedtotheuserwhentheapplicationislaunched.Movingfromoneactivitytoanotherisaccomplishedbyhavingthecurrentactivitystartthenextone.
Eachactivityisgivenadefaultwindowtodrawin.Typically,thewindowfillsthescreen,butitmightbesmallerthanthescreenandfloatontopofotherwindows.Anactivitycanalsomakeuseofadditionalwindows—forexample,apop-updialogthatcallsforauserresponseinthemidstoftheactivity,orawindowthatpresentsuserswithvitalinformationwhentheyselectaparticularitemon-screen.
Thevisualcontentofthewindowisprovidedbyahierarchyofviews—objectsderivedfromthebaseViewclass.Eachviewcontrolsaparticularrectangularspacewithinthewindow.Parentviewscontainandorganizethelayoutoftheirchildren.Leafviews(thoseatthebottomofthehierarchy)drawintherectanglestheycontrolandrespondtouseractionsdirectedatthatspace.Thus,viewsarewheretheactivity'
sinteractionwiththeusertakesplace.
Forexample,aviewmightdisplayasmallimageandinitiateanactionwhentheusertapsthatimage.Androidhasanumberofready-madeviewsthatyoucanuse—includingbuttons,textfields,scrollbars,menuitems,checkboxes,andmore.
Aviewhierarchyisplacedwithinanactivity'
swindowbytheActivity.setContentView()method.ThecontentviewistheViewobjectattherootofthehierarchy.(SeetheseparateUserInterfacedocument
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 应用程序基础Android Developers毕业设计外文翻译 应用程序 基础 Android Developers 毕业设计 外文 翻译