下载此文档

外文文献—Android起航毕业设计论文.docx


文档分类:论文 | 页数:约11页 举报非法文档有奖
1/11
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/11 下载此文档
文档列表 文档介绍
附录 I 英文原文
Beginning Android
. U sin g X M L -B a sed L a y ou ts
W hile i t i s technically possible to create and a ttach w idg ets to our activity purely throug h J ava code, the w ay w e did in C hapter 4 , the mon approach i s to use an X M L -based la y out fi le . Dy na mic instantiation of w idg ets i s reserved for plicated scenarios, w here the w idg ets a re not know n a pile-time ( e g ., populating a colum n of radio buttons based on data retrieved off the ).
W i th that in m ind, i t’s tim e to break out the X M L and learn how to la y out A ndroid activities that w a y.
1 W h a t Is a n X M L -B a sed L a y ou t?
A s the name sug g ests, an X M L -based la y out is a specification of w idg ets ’re la tionships to each other— and to their containers ( m ore on this in C hapter 7 )— encoded in X M L format. S pecifically, A ndroid considers X M L -based la y outs to be resources, and as such lay out fi les are stored in the res /la y out directory inside y our A ndroid project.
Each X M L fi le contains a tree of e lem ents specify ing a lay out of w idg ets and their containers that make up one v iew hierarchy. The a ttributes of the X M L e lem ents a re properties, describing how a w idg et should look or how a container should behave. For ex ample, if a B utton element has an a ttribute value of android: tex tS ty le = "bold", that means that the text appearing on the face of the button should be rendered in a boldface font sty le.
A ndroid’s S DK ships w ith a tool ( aapt) w hich uses the lay outs. This tool should be automatically invoked by y our A ndroid tool chain ( e .g ., Eclipse, A nt’s ml). Of particular im portance to y ou as a developer i s that aapt g enerates the R .java source fi le w i thin y our project, a l low ing y ou to access lay outs and w idg ets w i thin those l a y outs directly from y our J ava code.
2 W h y U se X M L -B a sed L a y ou ts?
M ost every thing y ou do using X M L la y out fi les can be achi

外文文献—Android起航毕业设计论文 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数11
  • 收藏数0 收藏
  • 顶次数0
  • 上传人mkjafow
  • 文件大小69 KB
  • 时间2018-02-21
最近更新