欢迎来到天天文库
浏览记录
ID:235906
大小:66.50 KB
页数:19页
时间:2017-07-11
《android编程权威指南-毕业论文外文文献翻译》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、附录一:英文原文AndroidProgrammingthebignerdranchguideCreatingUserInterfaceswithLayoutsandWidgetsInthischapter,youwilllearnmoreaboutlayoutsandwidgetswhileaddingacrime’sdateandstatustoCriminalIntent.UpgradingCrimeOpenCrime.javaandaddtwonewfields.TheDatefieldrepresentsthedateacri
2、meoccurred.Thebooleanfieldrepresentswhetherthecrimehasbeensolved.Listing8.1AddingmorefieldstoCrime(Crime.java)publicclassCrime{privateUUIDmId;privateStringmTitle;privateDatemDate;privatebooleanmSolved;publicCrime(){mId=UUID.randomUUID();mDate=newDate();}...}Initializing
3、theDatevariableusingthedefaultDateconstructorsetsmDatetothecurrentdate.Thiswillbethedefaultdateforacrime.Next,generategettersandsettersforyournewfields(Source→GenerateGettersandSetters...).Listing8.2Generatedgettersandsetters(Crime.java)publicclassCrime{...publicvoidset
4、Title(Stringtitle){mTitle=title;}publicDategetDate(){returnmDate;}publicvoidsetDate(Datedate){mDate=date;}publicbooleanisSolved(){returnmSolved;}publicvoidsetSolved(booleansolved){mSolved=solved;}}Yournextstepsareupdatingthelayoutinfragment_crime.xmlwithnewwidgetsandwir
5、ingupthosewidgetsinCrimeFragment.java.UpdatingtheLayoutHereiswhatCrimeFragment’sviewwilllooklikebytheendofthischapter.Figure8.1CriminalIntent,episode2Togetthisonscreen,youaregoingtoaddfourwidgetstoCrimeFragment’slayout:twoTextViewwidgets,aButton,andaCheckBox.Openfragmen
6、t_crime.xmlandmakethechangesshowninListing8.3.Youmaygeterrorsfrommissingstringresourcesthatyouwillcreateinamoment.Listing8.3Addingnewwidgets(fragment_crime.xml)7、roid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical">8、extandroid:id="@+id/crime_title"android:layout_width="match_parent"android:layout_height="wrap_content"android
7、roid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical">8、extandroid:id="@+id/crime_title"android:layout_width="match_parent"android:layout_height="wrap_content"android
8、extandroid:id="@+id/crime_title"android:layout_width="match_parent"android:layout_height="wrap_content"android
此文档下载收益归作者所有